-
be done with trigger (SQL 2000) ??
[Originally posted by m.posseth]
scenario :
i have a table with 2 fields one is a bit field (true - false ) the other is a smallint field
i want to know if it is possible to write a trigger that will set the integer field to 0
if the bit operator is set to 0 ( false )
if possible could someone show a small example ?? (or explain )ÿ ÿ
-
Re: be done with trigger (SQL 2000) ??
[Originally posted by FreeVBCode.com]
This assumes you have an identify field in there, named ID.
CREATE TRIGGER [myTrigger] ON [dbo].[MyTable]
FOR INSERT, UPDATE
AS
DECLARE @b bit
DECLARE @i int
SELECT @B = bitfield from Inserted
IF @B=0
SELECT @i = ID from Inserted
UPDATE MYTABLE SET INTFIELD=0 WHERE ID=@i
-
Re:Re: be done with trigger (SQL 2000) ??
[Originally posted by m.posseth@work]
thanks that was great ,,,
it did exactly what i wanted ,,,
it is time for me to buy a good SQL 2000 Book :-)
triggers are really great ( never used them before )ÿ
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|