Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Identifying Columns of Database Errors

Author  Topic 

mhg1063
Starting Member

27 Posts

Posted - 2004-10-07 : 08:47:03
I have an application that inserts/updates an mss 2000 database. The application returns database errors with a script of the insert/update. The problems are normal problems with data. Numeric values too large for column etc. Alpha character in numeric field etc. Let’s say the error returns a statement that returns an update of 100 columns. Once I have the statement is there an easy way to parse the statement the columns, which is having a problem. Most users will not have Query Analyzer available, however they will have an sql tool where they could execute the statement. The sql tool does not identify the problem field unless you comment out columns until you identify the culprit.

surefooted
Posting Yak Master

188 Posts

Posted - 2004-10-07 : 08:52:03
So when your application errors, it doesn't return an error, it just returns the insert/update script it was running that failed?

-Jon
Now a "Yak Posting Veteran".
Go to Top of Page

mhg1063
Starting Member

27 Posts

Posted - 2004-10-07 : 10:52:13
It returns a db error.
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2004-10-07 : 10:58:30
issue a set parseonly on before statement and set parseonly off after statement. this will not execute the statement.
Go to Top of Page

mhg1063
Starting Member

27 Posts

Posted - 2004-10-07 : 11:13:48
I tried the set parse only and it returns the db error but not the column in question.
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2004-10-07 : 11:19:36
i believe what you need is to validate the column values before issuing the sql statement.

you should handle the errors beforehand not during execution.
Go to Top of Page
   

- Advertisement -