SQL代码 alter PROCEDURE sp_addnewdtgtype
(
@dtgtypename varchar(50),
@dtgdllcontent image,
@returnmessage varchar(100)
)
AS
BEGIN
declare @dtgtableaddsql varchar(300);
declare @v_count int;
declare @yyyymmddhhmm char(12); select @v_count=COUNT(1) from tb_DTGs where dtgname=@dtgtypename;
if(@v_count=0)
begin
set @returnmessage='注册失败,该类型名称已存在'
return 0
end
else
begin
begin
begin try
begin tran select @yyyymmddhhmm=datename(year,GETDATE())+right(''+DATENAME(MONTH,GETDATE()),2)+right(''+DATENAME(DAY,GETDATE()),2)+right(''+DATENAME(HOUR,GETDATE()),2)+right(''+DATENAME(MINUTE,GETDATE()),2) insert into tb_DTGs(dtgid,dtgname,dtgdllcontent,createtime,updatetime) values(@v_count,@dtgtypename,@dtgdllcontent,@yyyymmddhhmm,@yyyymmddhhmm) commit tran
end try
begin catch
rollback tran
set @returnmessage='数据库未知错误,操作未能成功';
return 0
end catch
end
end
END
GO