create table robotData
(
idx int primary key,
title varchar(50) not null,
sensor char(5) default '00000',
buildLevel tinyint default 0,
programLevel tinyint default 0,
contents nvarchar(1000),
visit int default 0,
writeDate datetime default getdate()
)
create proc robotDataInsert
(
@title varchar(50),
@sensor char(5),
@buildLevel tinyint,
@programLevel tinyint,
@contents nvarchar(1000)
)
as
begin
insert into robotData(title, sensor, buildLevel, programLevel, contents)
values (@title, @sensor, @buildLevel, @programLevel, @contents)
end
create trigger TRG_ROBOTDATA_INS
on robotData
instead of insert
as
begin
set nocount on;
begin tran
begin try
declare @getTitle varchar(50)
declare @maxIdx int
select @getTitle = erc_db.dbo.blankDelete(@title) from inserted
end try
begin catch
if @@TRANCOUNT > 0
ROLLBACK TRAN
end catch
if @@TRANCOUNT > 0
COMMIT TRAN
end
댓글 영역