Dan Campbell
2017-07-06 15:14:10 UTC
Hi,
I’m using a function defined at
-- https://www.codeproject.com/Tips/798671/Split-string-into-Rows-Columns-using-Delimiters
for a 2008 function, but can’t figure out how to make it work with varchar field parameters. It works fine with simple strings.
So e.g.,
Select * from dbo.SplitDelimitedString('20|21/06/13#15|19/06/13#15|14/06/13','#')
Works fine.
But
This
USE mydatabase ;
SELECT dbo.SplitDelimitedString(myfield,'|') FROM mytable ;
Returns
Cannot find either column "dbo" or the user-defined function or aggregate
"dbo.SplitDelimitedField", or the name is ambiguous.
I’ve tried different combinations of prefixes, and almost always get the same result.
I also tried something I didn't expect to work, just for the heck of it,
SELECT * FROM SplitDelimitedString(mytable.pdLine,'|') ;
, and get the error
Incorrect syntax near '.'.
How do we send SplitDelimitedString() a field name from a table?
I’m using a function defined at
-- https://www.codeproject.com/Tips/798671/Split-string-into-Rows-Columns-using-Delimiters
for a 2008 function, but can’t figure out how to make it work with varchar field parameters. It works fine with simple strings.
So e.g.,
Select * from dbo.SplitDelimitedString('20|21/06/13#15|19/06/13#15|14/06/13','#')
Works fine.
But
This
USE mydatabase ;
SELECT dbo.SplitDelimitedString(myfield,'|') FROM mytable ;
Returns
Cannot find either column "dbo" or the user-defined function or aggregate
"dbo.SplitDelimitedField", or the name is ambiguous.
I’ve tried different combinations of prefixes, and almost always get the same result.
I also tried something I didn't expect to work, just for the heck of it,
SELECT * FROM SplitDelimitedString(mytable.pdLine,'|') ;
, and get the error
Incorrect syntax near '.'.
How do we send SplitDelimitedString() a field name from a table?