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
 COALESCE error

Author  Topic 

tpiazza55
Posting Yak Master

162 Posts

Posted - 2007-02-27 : 09:44:00
(COALESCE (MaterialNumber, '') + ' - ' + COALESCE (MaterialName, '') )AS materialDescription

I get an error saying cant covert varchar topsoil to type integer

materialnumber = number or null
materialname = name

how do i get

100 - Dirt
- Top Soil



spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-02-27 : 09:45:41
COALESCE (Convert(varchar(20), MaterialNumber), '')

Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-02-27 : 09:46:10
[code](COALESCE (MaterialNumber, '') + ' - ' + COALESCE (convert(varchar(10), MaterialName), '') )AS materialDescription[/code]


KH

Go to Top of Page

tpiazza55
Posting Yak Master

162 Posts

Posted - 2007-02-27 : 09:56:27
thanks
Go to Top of Page
   

- Advertisement -