longmatch
Programmer
- Nov 1, 2001
- 406
I am a novice for sql server 2000. Right now I have a problem need to be solved. I wrote a trigger to copy the inserted records into a new table. But there is a field need to save as a different value into the new table. In this case, I want to save the M and F as sex value instead of Male and Female. How can this be done in sql server 2000?
My trigger is like this.
CREATE TRIGGER [CopyPalmProcedure] ON dbo.Procedure_palm
FOR INSERT
AS
Declare @insertedCount Int
set @insertedCount = (select Count(*) From Inserted )
if (@insertedCount > 0 ) Begin
INSERT INTO [ProcedureData]
( DateOfProc,
ResidentName,
Rotation,
PtFirstName,
PtLastName,
DOB,
Sex,
Location,
MedRedNo)
SELECT DateOfProc,
ResidentName,
Rotation,
PtFirstName,
PtLastName,
DOB,
Sex,
Location,
MedRedNo
FROM INSERTED
End
thanks
longmatch
My trigger is like this.
CREATE TRIGGER [CopyPalmProcedure] ON dbo.Procedure_palm
FOR INSERT
AS
Declare @insertedCount Int
set @insertedCount = (select Count(*) From Inserted )
if (@insertedCount > 0 ) Begin
INSERT INTO [ProcedureData]
( DateOfProc,
ResidentName,
Rotation,
PtFirstName,
PtLastName,
DOB,
Sex,
Location,
MedRedNo)
SELECT DateOfProc,
ResidentName,
Rotation,
PtFirstName,
PtLastName,
DOB,
Sex,
Location,
MedRedNo
FROM INSERTED
End
thanks
longmatch