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

Asger Blond ab-mi at post3.tele.dk
Thu Jan 21 08:44:12 CST 2010


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.

-- 
John W. Colby
www.ColbyConsulting.com
_______________________________________________
dba-SQLServer mailing list
dba-SQLServer at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
http://www.databaseadvisors.com





More information about the dba-SQLServer mailing list