you can't say PRINT in a UDFVoid?Do you know what Books Online (BOL) is?This a table valued function. you can also create scalar functions (and aggregate?)CREATE FUNCTION [dbo].[udf_Table](@ParmList varchar(8000), @Delim varchar(20))RETURNS @table TABLE (Parameter varchar(255))AS /* SELECT * FROM dbo.udf_Table( 'a|~|b|~|c', '|~|')*/BEGIN DECLARE @x int, @Parameter varchar(255) WHILE CHARINDEX(@Delim, @ParmList)-1 > 0 BEGIN INSERT INTO @table(Parameter) SELECT SUBSTRING(@ParmList,1,CHARINDEX(@Delim, @ParmList)-1) SELECT @ParmList = SUBSTRING(@ParmList,CHARINDEX(@Delim, @ParmList)+LEN(@Delim), LEN(@ParmList)-CHARINDEX(@Delim,@ParmList)) END INSERT INTO @table(Parameter) SELECT @ParmList RETURNENDGO
Brett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxWant to help yourself?http://msdn.microsoft.com/en-us/library/ms130214.aspxhttp://weblogs.sqlteam.com/brettk/http://brettkaiser.blogspot.com/