[dba-SQLServer] How unique are SQL Server error numbers?

jwcolby jwcolby at colbyconsulting.com
Thu Jan 21 10:42:07 CST 2010


Asger,

 > Select master.sys.messages where message_id=XXXXX

That is a good thing to know.

Thanks!

John W. Colby
www.ColbyConsulting.com


Asger Blond wrote:
> Select master.sys.messages where message_id=2705 --> only gives the said error message. So it seems to be unique.
> Asger
> 
> -----Oprindelig meddelelse-----
> Fra: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] På vegne af jwcolby
> Sendt: 21. januar 2010 14:59
> Til: VBA; Sqlserver-Dba
> Emne: [dba-SQLServer] How unique are SQL Server error numbers?
> 
> I am calling stored procedures and passing back the error number and error string to my C# program. 
>   I am doing things like "create field, create index" etc.  If I am trying to create a field and it 
> already exists I get an error:
> 
> pErrorDesc	"Column names in each table must be unique. Column name 'AddrValid' in table 
> '_DataDepotEmailNew.dbo.AZImportFrom' is specified more than once."
> 
> And
> 
> pErrorNo	"2705"
> 
> So my question is, can I count on a 2705 being this "column name must be unique"?  If so, in my C# 
> program, I can count that as a successful field creation rather than a failure of the stored procedure.
> 
> ATM I am saying that a failure occurred and not performing the next step, whereas I really can do 
> the next step (update that field).
> 
> TIA for your assistance.
> 



More information about the dba-SQLServer mailing list