August 20, 2010 at 6:18 am
Hi,
Probably simple, but I can't find it..... after I inserted a number of rows into a table, where can I find how many rows that was?
For example:
INSERT INTO mytable
SELECT name FROM persons WHERE lastname='Jones'
SELECT @@number_of_inserted_rows
Thanks!
August 20, 2010 at 6:30 am
are you not getting it in result pane?
----------
Ashish
August 20, 2010 at 6:30 am
Either use @@ROWCOUNT as the immediately following comand after your insert statement or if you'd like to get more details from the values inserted use the OUTPUT clause in your INSERT statement. See BOL for details.
August 20, 2010 at 9:54 am
If you do SET ROWCOUNT ON before you run it (which is the default..so as long as you don't set it to Off), it should display the number of rows affected (on the messages tab).
Or if this is in a SP, then select @@rowcount directly after the insert will work, as said above (it has to be the next command).
August 21, 2010 at 4:02 am
ok, thanks!!!
Ray
August 21, 2010 at 1:11 pm
r.vanlaake-1086273 (8/21/2010)
ok, thanks!!!Ray
You say that but which suggestion did you follow? Some of these suggestions use a deprecated command and some won't give you what you want via code, just by eyeball. Which suggestion did you use?
--Jeff Moden
Change is inevitable... Change for the better is not.
August 22, 2010 at 3:07 am
I reply "OK Thanks" for all the people that give a suggestion. Tomorrow at the office I will try the various suggestions... so don'y know that now yet.
Ray
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply