jwcolby
jwcolby at colbyconsulting.com
Thu Jan 21 10:49:59 CST 2010
David, I have built up a library of stored procedures that I have, up to this point, executed manually or in another stored procedure. Being a programmer at heart, then next logical step is to execute these SPs from a C# program at the click of a button. That is what I am up to now. I am breaking the stored procedures down now that I can control them from C#. Where before I might Make a table Create a cover query in a source table. Append data from the source into the new table Create a couple of indexes in the new table I would do all of the above in a single stored procedure. I now want to be able to do each of these steps individually and know back in C# what happened. Perhaps the make table failed for some reason. Creating the cover index on the source failed, but it failed because the index already exists. Appending data from source to destination worked, but how many records went? Etc. Having a real programming environment from which to cause these to happen and log the results is a HUGE step up from what I was capable of directly in TSQL. I view it as the best of both worlds. John W. Colby www.ColbyConsulting.com David McAfee wrote: > 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 > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > >