To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here

HOME News MS SQL Oracle DB2 Access MySQL PHP Scripts Books Links DBA Talk


Go Back   Database Journal Forums > Miscellaneous > General Database Discussions

General Database Discussions Discuss any database topic not covered in any other forum on this site

Reply Post New Thread
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 02-13-2003, 10:46 AM
swabips swabips is offline
Junior Member
 
Join Date: Feb 2003
Location: St. Louis
Posts: 1
Exclamation Ms Sql @@error

When using EXEC() to execute a tsql_string, does it return an @@ERROR value? If I run this code:

**********************************
DECLARE @var varchar(8000)
SET @var = 'SELECT * FROM A'
EXEC (@var)

SELECT@@ERROR AS ErrorVar
**********************************

@@ERROR returns 0 even when I don't have a table named "A" and an error has happened. Is there anyway around this? I'm running a lot of insert statements and RI has been established. If there is an error, I need to rollback the transaction, but in the above case, it would commit, even though it errored out.

Thanks for any advice.
Reply With Quote
  #2  
Old 02-13-2003, 08:40 PM
Rawhide's Avatar
Rawhide Rawhide is offline
Moderator
 
Join Date: Feb 2003
Posts: 1,046
Works for me when I try your sample code. Just make sure you have a space between SELECT and @@ERROR. Your example doesn't.
Reply With Quote
Reply Post New Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 06:35 AM.


DatabaseJournal Recent Articles


 » Preparing To Upgrade Access Tables to SQL ...

 » Microsoft Windows PowerShell and SQL Serve...

 » New MySQL Enterprise with Query Analyzer B...

 » Quest Software Strengthens Committment to ...

 » Oracle Unveils New Event-Driven Middleware...

Search Database Journal:
 





Acceptable Use Policy

JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers

Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.