상세 컨텐츠

본문 제목

robotData

청강컴정/09DataBase기말고사

by luckey 2009. 6. 6. 17:05

본문

create table robotData
(
 idx int not null primary key,
 title varchar(50) not null unique nonclustered,
 folderName varchar(50) not null unique nonclustered,
 contents text not null,
 date datetime default getdate(),
 visit int default 0,
 imgCount int default 0,
 buildLevel tinyint default 0,
 sourceLevel tinyint default 0,
 sensorTouch bit default 0,
 sensorLight bit default 0,
 sensorUltra bit default 0,
 sensorSound bit default 0,
 sensorMotor bit default 0
)
go

----프로시져
create proc robotDataInsert
(
 @title varchar(50)
 @folderName varchar(50)
 @imgCount tinyint
 @robotLevel char(2)
 @robotSensor char(5)
)
as
begin
 insert into robotData values(title, folderName, imgcount, robotLevel, robotSensor)
end
go


--트리거
create trigger TRG_ROBOTDATA_INS
on robotData
instead of insert
as
begin

 set nocount on;
 begin tran
 begin try

  declare @

 end try

 begin catch
 if @@TRANCOUNT > 0
  ROLLBACK TRAN
 end catch

 if @@TRANCOUNT >0
 COMMIT TRAN

end

관련글 더보기

댓글 영역