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.
Author |
Topic |
tooba
Posting Yak Master
224 Posts |
Posted - 2013-02-19 : 23:03:23
|
Hi Guys, Here is my UDFCreate Function [dbo].[udf_GetValue](@PID int)returns varchar(1000)asbegin Declare @Message varchar(1000) Select @Message = Message From tbMessage Where PId = @PID return isnull(@Message,'') endI want to knowLet say if there is two PID How i can get , seperate MessagesEnd Result should beMESSAGEMSG1,MSG2,MSG3,....I know UDF return only one value.ANy advise? |
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2013-02-19 : 23:44:57
|
[code]beginDeclare @Message varchar(1000) Select @Message = COALESCE(@message, ', ') + Message + ', ' From tbMessage Where PId = @PID return STUFF(isnull(@Message,''), 1,2,'')endSELECT dbo.udf_GetValue( IdValue)[/code]--Chandu |
|
|
tooba
Posting Yak Master
224 Posts |
Posted - 2013-02-20 : 00:46:02
|
Awesome Bandi, Thank you for your help.... |
|
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2013-02-20 : 00:49:25
|
quote: Originally posted by tooba Awesome Bandi, Thank you for your help....
Welcome--Chandu |
|
|
|
|
|
|
|