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 () --------------------- Result --------------------------- 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 |