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)
 get the string return from select statement

Author  Topic 

niravg
Starting Member

17 Posts

Posted - 2005-01-03 : 13:17:39
hi all:

i have table table1(actId,conId,...)

actId and conId is composite key..conId can have more than one actId

e.g.
table1(actId,conId)
1 1
2 1
3 1

I want a select query that should return actId as a string like "1,2,3" for conId=1

how do i do this?

any help?

thanks

-Nii


Seventhnight
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2005-01-03 : 13:19:05
Declare @actId varchar(1000)

Select @actId = isnull(convert(varchar,actId)+',','') + convert(nvarchar,actId) From table1 Where conId = 1

Corey
Go to Top of Page
   

- Advertisement -