September 27, 2002 at 7:05 pm
I cant for the life of me remember how to do this...
select surname ||","|| firstname as name from CS_STAFF
the above doesnt work, does neone know the proper way? Thanks!
September 27, 2002 at 7:25 pm
Is this what you are looking for:
DECLARE @names varchar(500)
SET @names = ''
SELECT @names = @names + ',' + surname
FROM CS_STAFF
SET @names = RIGHT(@names, LEN(@names) - 1)
PRINT @names
Robert Marda
SQL Server will deliver its data any way you want it
when you give your SQL Programmer enough developing time.
Robert W. Marda
Billing and OSS Specialist - SQL Programmer
MCL Systems
September 27, 2002 at 7:57 pm
ohh what a dummy! I realise my mistake..instead of " i should have used 'so that is looks like the following:
select SURNAME || ', ' || FIRSTNAME from CS_STAFF
thanks for ur reply
September 27, 2002 at 8:02 pm
or
select SURNAME || ', ' || FIRSTNAME as Name from CS_STAFF
if u want to give the column a name called "Name"
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply