How to concatenate literal expression with other fields in T-SQL
Posted on 2004-04-30
I'm trying to cancatenate the following: a float field truncated to an int, combined with the literal string ' miles' to form the aliased varchar field distance, but getting a casting exception
CAST(CAST(z.distance AS INT) + ' miles' AS varchar(9))AS distance
[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the varchar value 'miles' to a column of data type int.
Any ideas as to what I'm doing wrong?