Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calling a UDF - Getting An Error - Part 2
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
01326464
Message ID:
01326468
Views:
14
>I wrote another UDF to convert a comma delimited list of string values to a table. When I call it, I get "Invalid object name 'TranCodes'". The error is occuring on the last query:
>
>
>
>DECLARE @sTransTypeCodes varchar(50)
>SET @sTransTypeCodes = 'PR,PD'
>
>--SELECT * FROM udfParseCommaListToTable(@sTransTypeCodes, ',') AS TranCodes
>
>SELECT *
> 	FROM Transactions
>	WHERE sTrans_Type_CD IN
>		(SELECT DataItems FROM from udfParseCommaListToTable(@sTransTypeCodes, ','))
>
See changes inline.

Or you can also try:
select Tr.* from Transactions Tr 
INNER JOIN (select * FROM udfParseCommaListToTable(@sTransTypeCodes, ',')) Codes 
on Tr.sTrans_Type = Codes.DataItems
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform