Hi there!
I have a table with three columns: Id, Name and Departament. (ex: 23, "Mary", "Check-out")
I'd like to write a SQL Select clause so that the three columns are combined in just one column (ex: "23 - Mary - Check-out")
Is it possible? Many thanks for any kind of help.
Hi,
assuming ID is int
SELECT cast(ID as char(5)) + ' - ' + Name + ' - ' + Department AS TheNameYouLike
FROM YourTableName
|||try this
SELECT CAST(ID AS varchar(5))+'-'+ltrim(Rtrim(Name))+'-'+ltrim(rtrim(Department) From yourtablename
Madhu
No comments:
Post a Comment