mouhamad2009
2013-02-25, 16:56
ارجوك اريد تعريف لدوال المدمجة Buiilt-in Function
وشكل العام لكتابة الدوال الندمجة
-2-Number
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER FUNCTION [dbo].[Number] (@id int)
RETURNS nvarchar(4) AS
begin
declare @Num nvarchar(4)
if len(cast(@id as char))=1
set @Num='000'+cast(@id as char)
else
if len(cast(@id as char))=2
set @Num='00'+cast(@id as char)
else
if len(cast(@id as char))=3
set @Num='0'+cast(@id as char)
else
set @Num=cast(@id as char)
Return @Num
end
وشكل العام لكتابة الدوال الندمجة
-2-Number
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER FUNCTION [dbo].[Number] (@id int)
RETURNS nvarchar(4) AS
begin
declare @Num nvarchar(4)
if len(cast(@id as char))=1
set @Num='000'+cast(@id as char)
else
if len(cast(@id as char))=2
set @Num='00'+cast(@id as char)
else
if len(cast(@id as char))=3
set @Num='0'+cast(@id as char)
else
set @Num=cast(@id as char)
Return @Num
end