Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Georgefu
Starting Member
4 Posts |
Posted - 2007-09-04 : 13:03:32
|
Hi,I try to execute many sql statements through dynamic sql, and log in the errors for each sql based on the @@ERROR value. But the @@ERROR doesn't always return values, in my code below, I did get value for the insert statement ( I usered inset on purpose) and the create table did NOT retune anything.CREATE PROCEDURE dbo.test1 AS BEGIN Declare @sql_stmt1 VARCHAR(4000), @message varchar(255), @errnum int BEGIN --SELECT @sql_stmt1 = 'CREATE TABLE dbo.xx(y int) ' SELECT @sql_stmt1 = 'inset into dbo.xx VALUES (1) ' select @sql_stmt1 STMT Exec (@sql_stmt1) set @errnum = @@ERROR SELECT @errnum err endENDgoPlease help.George |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-09-04 : 13:07:26
|
Duplicate, locking this thread.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/ |
 |
|
|
|
|