Click here to Skip to main content
15,893,487 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear sir
I stored the values in database columns by separating commas(,) then I made a function to split the values to stored in different columns, but I don't know the syntax of using function in sql server.

please help me
Posted
Updated 3-May-11 1:55am
v2
Comments
Toniyo Jackson 3-May-11 7:51am    
You can use it like tables. select functionname(...)
Rajesh Anuhya 3-May-11 7:58am    
??
Toniyo Jackson 3-May-11 8:00am    
See John's answer.
Rajesh Anuhya 3-May-11 8:02am    
ok ..,i am agree with John's Answer, am asking you what is the meaning of your comment ("You can use it like tables.")
Mahendra.p25 3-May-11 7:58am    
Post your split function

SQL
select dbo.MyFunctionName(@param1..)
 
Share this answer
 
 
Share this answer
 
Well this example might help you out in SQLServer 2005:

CREATE FUNCTION MyFunction ()
RETURNS @Tbl TABLE
(
StudentID VARCHAR(255),
SAS_StudentInstancesID INT,
Label VARCHAR(255),
Value MONEY,
CMN_PersonsID INT
)
AS
BEGIN
INSERT @Tbl
(
StudentID ,
SAS_StudentInstancesID ,
Label ,
Value ,
CMN_PersonsID
)
SELECT
StudentID ,
SAS_StudentInstancesID ,
Label ,
Value ,
CMN_PersonsID
FROM MyView -- where MyView selects (with joins) the same columns from large table(s)
RETURN
END

or you can have a check at this link as well, it has all the details you need.
http://msdn.microsoft.com/en-us/library/ms186755(v=SQL.90).aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900