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
 Error converting data type varchar to numeric.

Author  Topic 

Pinto
Aged Yak Warrior

590 Posts

Posted - 2007-02-14 : 09:48:43
Select SchoolNumber + ' ' + ShortSchoolName as SchoolList from tblSchoolsSubset

This is my simple sql statement which generates the error in the subject line.

SchoolNumber is type numeric and ShortSchoolName is nvarchar

There are only numbers in SchoolNumber.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-02-14 : 09:54:08
convert to varchar before concat

Select convert(varchar(10), SchoolNumber) + ' ' + ShortSchoolName as SchoolList from tblSchoolsSubset




KH

Go to Top of Page

Pinto
Aged Yak Warrior

590 Posts

Posted - 2007-02-14 : 09:58:22
Thanks - works a treat.
Go to Top of Page
   

- Advertisement -