Click here to Skip to main content
15,898,721 members
Home / Discussions / Database
   

Database

 
GeneralRe: C# and SQL General Strategy Question Pin
Not Active22-Sep-06 4:03
mentorNot Active22-Sep-06 4:03 
GeneralRe: C# and SQL General Strategy Question Pin
Jethro6322-Sep-06 4:05
Jethro6322-Sep-06 4:05 
GeneralRe: C# and SQL General Strategy Question Pin
Jerry Hammond22-Sep-06 14:56
Jerry Hammond22-Sep-06 14:56 
AnswerRe: C# and SQL General Strategy Question Pin
Mike Dimmick23-Sep-06 0:29
Mike Dimmick23-Sep-06 0:29 
GeneralRe: C# and SQL General Strategy Question Pin
Jethro6324-Sep-06 15:55
Jethro6324-Sep-06 15:55 
QuestionMultiple select Pin
netDeveloper22-Sep-06 1:21
netDeveloper22-Sep-06 1:21 
AnswerRe: Multiple select Pin
Kschuler22-Sep-06 9:08
Kschuler22-Sep-06 9:08 
AnswerRe: Multiple select Pin
Eric Dahlvang22-Sep-06 9:37
Eric Dahlvang22-Sep-06 9:37 
I don't know why you would want something like this, but it sounds like you need a function:
CREATE FUNCTION GetProjectIDs (@nClientID int)  
RETURNS  varchar(1000) AS  
BEGIN 

DECLARE @nProjectID int
DECLARE @cProjectIDs varchar(50)

SELECT @cProjectIDs = ''

DECLARE  ProjectIDs CURSOR FOR 
SELECT ProjectID 
FROM ProjectClient
WHERE ClientID = @nClientID
ORDER BY ProjectID

OPEN ProjectIDs
FETCH NEXT FROM ProjectIDs INTO @nProjectID 
WHILE @@FETCH_STATUS = 0
BEGIN
	select @cProjectIDs = @cProjectIDs + case when len(@cProjectIDs) = 0 then '' else ',' end + cast( @nProjectID as varchar)
	FETCH NEXT FROM ProjectIDs INTO @nProjectID 
END

CLOSE ProjectIDs
DEALLOCATE ProjectIDs
RETURN(@cProjectIDs)
END

Then call it like this:
select *, dbo.GetProjectIDs(client.clientid) as ProjectIDs from client



--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters

AnswerRe: Multiple select Pin
Mike Dimmick23-Sep-06 0:55
Mike Dimmick23-Sep-06 0:55 
AnswerRe: Multiple select Pin
netDeveloper23-Sep-06 6:15
netDeveloper23-Sep-06 6:15 
QuestionHello ! Pin
Bravoone_200621-Sep-06 22:39
Bravoone_200621-Sep-06 22:39 
QuestionSQL Server Replication Pin
oskardiazdeleon21-Sep-06 21:28
oskardiazdeleon21-Sep-06 21:28 
AnswerRe: SQL Server Replication Pin
Hesham Amin24-Sep-06 3:18
Hesham Amin24-Sep-06 3:18 
QuestionSql,/Access/Oracle to Excel Pin
vicky0000021-Sep-06 20:59
vicky0000021-Sep-06 20:59 
Questiondeploying a .net winforms that has to connect to remote sql server Pin
steve_rm21-Sep-06 19:46
steve_rm21-Sep-06 19:46 
AnswerRe: deploying a .net winforms that has to connect to remote sql server Pin
Jim Conigliaro22-Sep-06 10:55
Jim Conigliaro22-Sep-06 10:55 
QuestionSQL server nested tables or what? Pin
iskaza21-Sep-06 13:14
iskaza21-Sep-06 13:14 
AnswerRe: SQL server nested tables or what? Pin
Rob Graham21-Sep-06 14:04
Rob Graham21-Sep-06 14:04 
GeneralRe: SQL server nested tables or what? Pin
iskaza21-Sep-06 14:22
iskaza21-Sep-06 14:22 
GeneralRe: SQL server nested tables or what? [modified] Pin
Rob Graham21-Sep-06 14:43
Rob Graham21-Sep-06 14:43 
QuestionOne more question Pin
iskaza21-Sep-06 15:12
iskaza21-Sep-06 15:12 
AnswerRe: One more question Pin
Rob Graham21-Sep-06 17:36
Rob Graham21-Sep-06 17:36 
QuestionRe: One more question Pin
iskaza22-Sep-06 3:00
iskaza22-Sep-06 3:00 
GeneralDesign question - returning varying results Pin
Judah Gabriel Himango21-Sep-06 5:47
sponsorJudah Gabriel Himango21-Sep-06 5:47 
GeneralRe: Design question - returning varying results Pin
Eric Dahlvang21-Sep-06 6:42
Eric Dahlvang21-Sep-06 6:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.