-- 通過存儲過程獲得的時間字符串作為編號,含年月日时分秒,12个字符,
-- maker:djh
CREATE PROCEDURE Com_GetNoByDate
AS
BEGIN
declare @str nvarchar(20) , @year nvarchar(2) , @month nvarchar(2) ,@day nvarchar(2),
@hh nvarchar(2) , @mm nvarchar(2) , @ss nvarchar(2)
set @year =( select substring( convert(nvarchar(4),getdate(),120),3,2 )) --
if month(getdate())<10
begin
set @month= ( select '0'+ convert(nvarchar(2),month(getdate()),120) )
end
else
begin
set @month= ( select convert(nvarchar(2),month(getdate()),120) )
end
if day(getdate())<10
begin
set @day=( select '0'+ convert(nvarchar(2),day(getdate()),120) )
end
else
begin
set @day= ( select convert(nvarchar(2),day(getdate()),120) )
end
set @hh= ( select substring(convert(nvarchar(20),getdate(),120),12,2) )
set @mm=( select substring(convert(nvarchar(20),getdate(),120),15,2) )
set @ss= ( select substring(convert(nvarchar(20),getdate(),120),18,2) )
set @str = @year+@month+@day+@hh+@mm+@ss
select @str as datestr
END
-- exec Com_GetNoByDate