SQLTeam.com | Weblogs | Forums

Query


#1

I have a table with HomeStudent1 and need a trigger which should check for the record if the datalength(stunotes) = 20
if exists then it should insert that record to FacultyStudent2
and delete that record from HomeStudent1

Table: HomeStudent1

stid varchar(40),
stname varchar(20),
stunotes text

Table: FacultyStudent2

stid varchar(40),
stname varchar(20),
stunotes text

Thanks for your help in advance


#2

Suggest you post whatever you have managed to do so far, and then folk will make suggestions.


#3

Thanks Kirsen

There are multiple options to achieve it but i could the accomplish with the below method which i don't want..

delete from [dbo].[HomeStudent1]
output DELETED.*INTO [dbo].[FacultyStudent2]
where DATALENGTH([stunotes]) = 20

I need a trigger to achieve the same result as above query.