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
 General SQL Server Forums
 New to SQL Server Programming
 Isnull in cast or cast in isnull

Author  Topic 

WJHamel
Aged Yak Warrior

651 Posts

Posted - 2012-04-27 : 09:34:54
In the following, each part needs to be cast because it's dropping into a deprecated text field. But there are nasty NULLs in some of the fields so i have to wrap them in isnulls. Not sure if the isnull comes before or after the cast? Help?


CAST(Comments AS VARCHAR(MAX)) + '. ' + CAST(Typeservicecomments AS VARCHAR(MAX))
+ '. ' + CAST(Generalcomments AS VARCHAR(MAX))

robvolk
Most Valuable Yak

15732 Posts

Posted - 2012-04-27 : 09:47:42
CAST(ISNULL(Comments,'') AS VARCHAR(MAX)) + '. ' + CAST(ISNULL(Typeservicecomments,'') AS VARCHAR(MAX))
+ '. ' + CAST(ISNULL(Generalcomments,'') AS VARCHAR(MAX))
Go to Top of Page

WJHamel
Aged Yak Warrior

651 Posts

Posted - 2012-04-27 : 09:52:45
thanks rob.
Go to Top of Page
   

- Advertisement -