Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / General / Other SQL Server Topics / October 2005

Tip: Looking for answers? Try searching our database.

Need to catch SQL error messages

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kathir - 28 Oct 2005 17:16 GMT
Hi,
I need to catch the SQL error messages, generated while executing a query.
Basically with reference to the Error Number, I can get the message from
sysmessages table. But that would be a raw one.
For ex, that would be like :
Must declare the variable '%.*ls'.

But normally the error message will be displayed as :
Must declare the variable '@Name'
I want to catch this error message in a variable and log into my table.

Looking for your help. Appreciate it.

Signature

Kathiravan Manimozhi
Senior Programmer
Accenture Services Pvt. Ltd.,
Mumbai - 400079
India.

Ed - 30 Oct 2005 05:49 GMT
Kathir,
 You may want to look at FormatMessage in BOL
HTH
Ed

> Hi,
> I need to catch the SQL error messages, generated while executing a query.
[quoted text clipped - 8 lines]
>
> Looking for your help. Appreciate it.
Kathir - 31 Oct 2005 14:09 GMT
Thanks Ed.
But the problem is i don't know what the error number would be and i don't
know what the values i need to pass for the placeholders. All i need is a
generalized method which will catch the complete error message thrown by SQL.
Signature

Kathiravan Manimozhi
Senior Programmer
Accenture Services Pvt. Ltd.,
Mumbai - 400079
India.

> Kathir,
>   You may want to look at FormatMessage in BOL
[quoted text clipped - 13 lines]
> >
> > Looking for your help. Appreciate it.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.