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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Help for sql

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-04-18 : 09:43:04
afu writes "Good day.

I would like to combine number and characters into one select statement.

for example,


SELECT
productid,productid & ' ' & productdescription & ' $ ' & unitprice as lp FROM
products

Here productid and unitprice is a number field and productdescription is character. This syntax does not work. Can you help?



Thanks.

Afzal."

dsdeming

479 Posts

Posted - 2002-04-18 : 10:02:52
Try

SELECT
productid, CAST( productid AS varchar( 20 ))+ ' ' + productdescription + ' $ ' + CAST( unitprice AS varchar( 20 )) as lp FROM
products

HTH

Go to Top of Page
   

- Advertisement -