IF EXISTS ( SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[Get_II_list]') AND xtype IN (N'FN', N'IF', N'TF') ) DROP FUNCTION [dbo].[Get_II_list] GO CREATE FUNCTION Get_II_list ( ) RETURNS varchar(800) AS BEGIN DECLARE @s varchar(800) SET @s='' SELECT @s = ','+ISNULL(name,'')+@s FROM II IF(len(@s)>1) SET @s=right(@s,len(@s)-1) RETURN @s END Go ********************************************************** SELECT dbo.Get_II_list() ---------------------結果--------------------------- Bin,jack,Hung,way,Danny ――――――――――――――――― IF EXISTS( SELECT * FROM dbo.sysobjects WHERE id=OBJECT_ID(N'[dbo].[is_all_number]') AND xtype IN (N'FN', N'IF', N'TF') ) DROP FUNCTION [dbo].[is_all_number] go CREATE FUNCTION is_all_number( @in varchar(10) ) RETURNS integer AS BEGIN DECLARE @i integer, @l integer, @c char SET @l=len(@in) IF(@l<=0) RETURN 0 SET @i=1 WHILE(@i<=@l) BEGIN SET @c=substring(@in,@i,1) IF (@c<'0' OR @c >'9') RETURN 0 SET @i=@i+1 END RETURN 1 END go |