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 2008 Forums
 Transact-SQL (2008)
 T-SQL script analysis

Author  Topic 

stardust12
Starting Member

2 Posts

Posted - 2011-10-15 : 19:39:20
I have a T-SQL script that runs in the backend and in the front end i get the following error "Conversion from type 'DBNull' to type 'String' is not valid " . What is the best way to troubleshoot this script ? would running a trace help or is there a better method ? how do i find out which variables are getting passed to this script. Thanks in advance

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-16 : 00:08:03
i think you're expecting a string value for some field and its returned as NULL from db which is causing this conversion error. One way to solve it is to use ISNULL or COALESCE to convert NULL to valid string values. Another way is to do this conversion at your front end. Analyse the line giving you error in front end and you will get the field which is causing this.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

stardust12
Starting Member

2 Posts

Posted - 2011-10-16 : 00:19:06
Thanks for replying but i was able to resolve this using SQL profiler and running a trace
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-16 : 00:22:53
ok great

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -