摘要:
CREATEFUNCTION[dbo].[RandInt](@GuidValueasuniqueidentifier)RETURNSintASBEGINdeclare@strasvarchar(10)set@str=left(@GuidValue,8)declare@iasintdeclare@numberasintset@i=0set@number=0while(@i<8)beginset@number=@number+(Ascii((substring(@str,@i+1,1)))*Power(10,@i))set@i=@i+1endreturn@numberEND 阅读全文