Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rows affected by Insert

Status
Not open for further replies.

KarthikBabu

Programmer
Jul 17, 2001
18
IN
In T-SQL, Is there a way to find out the number of rows affected by an insert query?

I have the following statement.

Insert into #temp_table
select (....)

Now, without using 'select count(*) from #temp_table', is there any way (or system function) by which i can find out the number of rows inserted into the #temp_table. I think, in Oracle there is something called %ROWCOUNT. Is there a Sybase equivalent?
 
In Oracle this function is called SQL%ROWCOUNT. In Sybase it is called @@rowcount. It contains the number of rows affected by the last query. @@rowcount is set to 0 by any command that does not return rows, such as an if, update, or delete statement. With cursors, @@rowcount represents the cumulative number of rows returned from the cursor result set to the client, up to the last fetch request.

good luck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top