Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
Thread: DELETEd rows count
07-08-2009, 02:05 AM #1
- Join Date
- Jul 2008
- Thanked 11 Times in 11 Posts
DELETEd rows count
Hi. How can I get the amount of rows deleted by a DELETE statement in SQL? I need to print the count on my page (I am using ColdFusion). Thanks.-MacWiz1220
Science fiction does not remain fiction for long. And certainly not on the Internet.
-Vinton Cerf: Chief Internet Evangelist for Google and co-creator of the TCP/IP Internet Protocol Suite
07-08-2009, 03:04 AM #2
Check your ColdFusion docs. It's probably got something builtin.
For example, in ASP coding, you can doand upon completion the variable howmany contains a count of the number of records affected (deleted or updated or inserted, as the case may be for the sql used).Code:connection.Execute "...sql code...", howmany
Similar constructs are available with JSP.
So I'd be surprised if CF doesn't have a "built-in" way so that you don't have to pull trickery to find out.
07-08-2009, 03:20 AM #3
I poked around in the CF docs and didn't see anything except RecordCount. One would *HOPE* that CF would use that to return the count of records deleted, but maybe not. CF is pretty old technology and it doesn't seem to have tried to catch up with other server side systems.
Worst come to worst, I would think you could write a stored procedure that would do the delete and then do a SELECT NNN to return a recordset with just one record and once column, that being the count of deleted records.
You could easily do that in SQL Server or MySQL, though the syntax in each is completely different. So what DB are you using?