SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 How to check TSQL's EXECUTE command for error
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

yommy1831
Starting Member

USA
10 Posts

Posted - 07/11/2013 :  19:40:30  Show Profile  Reply with Quote
Hello,

I am TOTALLY new with TSQL/SQL. consider the code below:

EXECUTE sp_executesql @sql, N'@xmldataOUT xml OUTPUT', @xmldataOUT=@instance OUTPUT;

CREATE XML SCHEMA COLLECTION FASSchema AS @instance

How can:
1. Add a check to the EXECUTE command to see if it fails
2. what is a suitable way to display an error message in case the EXECUTE command fails
3. Add a check to the CREATE command to see if it fails

Your help will be highly appreciated. I need people to jumpstart me

bandi
Flowing Fount of Yak Knowledge

India
2217 Posts

Posted - 07/12/2013 :  00:28:39  Show Profile  Reply with Quote
You can use following methods to handle runtime exceptions...
1) TRY...CATCH
2) RAISERROR()
Check in google for those topics

NOTE: Don not open multiple threads for same issue
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=186770
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=186769

--
Chandu
Go to Top of Page

yommy1831
Starting Member

USA
10 Posts

Posted - 07/12/2013 :  07:16:19  Show Profile  Reply with Quote
Thanks Chandu. I am still a little confused after reading the article.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000