SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SQl function returning NUll though the query used in function pulls up the data.


SQl function returning NUll though the query used in function pulls up the data.

Author
Message
sathish.tbj
sathish.tbj
SSC Veteran
SSC Veteran (234 reputation)SSC Veteran (234 reputation)SSC Veteran (234 reputation)SSC Veteran (234 reputation)SSC Veteran (234 reputation)SSC Veteran (234 reputation)SSC Veteran (234 reputation)SSC Veteran (234 reputation)

Group: General Forum Members
Points: 234 Visits: 52
Hello,

I have created a SQl function that pulls up the concatenated text from the select query. The query has coalesce function embeded in it. The function always returns NULL when executed, though data is present. Help needed.

Function code:
==========
ALTER function [dbo].[GetEloquaColumn]
(@Code_String varchar(200)) returns varchar(300)
as
begin
declare @code varchar(200)
set @code =replace(@Code_String,',',''',''')
set @code=''''+@code+''''
DECLARE @CodeList varchar(250)
SELECT @CodeList=COALESCE(@CodeList+',','') + rtrim(ELOQUA_field_reference)
FROM sysdba.Slx_Eloqua_Code_Reference WHERE slx_pat_codes in (@code)

RETURN @CodeList
end
tommyh
tommyh
SSCertifiable
SSCertifiable (5.9K reputation)SSCertifiable (5.9K reputation)SSCertifiable (5.9K reputation)SSCertifiable (5.9K reputation)SSCertifiable (5.9K reputation)SSCertifiable (5.9K reputation)SSCertifiable (5.9K reputation)SSCertifiable (5.9K reputation)

Group: General Forum Members
Points: 5856 Visits: 2000
Crossposting = bad.

Discussion about this can be found here as well
http://www.sqlservercentral.com/Forums/Topic992468-338-1.aspx
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum









































































































































































SQLServerCentral


Search