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

David McAfee davidmcafee at gmail.com
Thu Jan 21 08:41:37 CST 2010


John, you can trap for built in errors (such as 2705) in TSQL, or you can
raise your own if/when certain conditions are met.

Sent from my Droid phone.

On Jan 21, 2010 6:00 AM, "jwcolby" <jwcolby at colbyconsulting.com> wrote:

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-VB mailing list
dba-VB at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-vb
http://www.databaseadvisors.com



More information about the dba-VB mailing list