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!

Query Status Code

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
How do i get the status code of the query fired i.e. whether the query was successful or not.(insert, update and delete)
 
Well, if the insert /update fails because of a constraint, you'll get notified at runtime - this notification will depend on the environment you are using, alternatively, if you want to see how many rows an update /insert /select affects, you could use the @@rowcount variable eg:

select * from sysobjects
select @@rowcount

 
or you can insert @@error at the end of your query:

IF @@ERROR > 0
PRINT 'There is an Error!'
ELSE
PRINT 'No Error'

Andel
andel@barroga.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top