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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Calling stored function in a query

Author  Topic 

maverick0681
Starting Member

2 Posts

Posted - 2009-08-11 : 02:09:00
hello all
i have created a function which is successfully compiled and stored , now i want to use this function in the query .
eg: Split function which is returning a table
now i want to use this function on a table column like
<tablename>.<coulmnname>
ie i want to call Split on the data in column <tablename>.<columnname>
select * from Split(<tablename>.<columname>,@delimiter)


how should i proceed ?
please explain in details mentioning all schema names to be used.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-08-11 : 03:05:38
is it a stored procedure or function ?

You can't call a stored procedure in side a SELECT query.

Since you mention "Split function", i assume it is a function. If you are using SQL 2005 / 2008, you can use CROSS APPLY on the split function


select *
from yourtable t
cross apply split(t.<column name>, @delimiter) s



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -