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.
| Author |
Topic |
|
bntringa
Starting Member
5 Posts |
Posted - 2006-05-18 : 12:59:23
|
| Hey all,I am trying to combine a varchar column and an int column into one new column via the following sample:SELECT VC1 + ' ' + INT1FROM TestVC1 is varchar (10)INT1 is int (4)This works fine with two varchar columns, but introducing the int field causes the following error:"Syntax error converting the varchar value to a column of data type int".Is there a way to specify the new column type are varchar to handle this correctly?thanks!- Brian |
|
|
mmahmed
Starting Member
6 Posts |
Posted - 2006-05-18 : 13:21:29
|
| Hi BrianTry the following:SELECT VC1 + ' ' + CAST(INT1 as varchar(10))FROM TestCheersMoosh |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2006-05-18 : 13:21:38
|
| SELECT VC1 + ' ' + CONVERT(varchar(20), INT1)FROM TestKristen |
 |
|
|
|
|
|