Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Trigger Help

Author  Topic 

sshay
Starting Member

1 Post

Posted - 2003-01-13 : 11:05:26
Hello All

I am working on a Trigger and I need a little help. I want the Trigger to fire once I set the status to True in the Items_TBL to populate the StartDate & EndDate Values from the Settings_TBL

Is there anyway to populate existing values in the Items_TBL which have the status="TRUE" After I create the Trigger

Thanks
Stuart

Settings_TBL

ID (int)
StartDate (date)
EndDate (date)

Items_TBL

ItemID (int)
StartDate (date)
EndDate (date)
Status (varchar)


CREATE TABLE [dbo].[Settings_TBL] (
[ID] [int] NULL ,
[StartDate] [datetime] NULL ,
[EndDate] [datetime] NULL
) ON [PRIMARY]
GO

INSERT INTO Settings_TBL (ID,StartDate,EndDate) VALUES
('1','1/10/2003','1/31/2003')


CREATE TABLE [dbo].[Item_TBL] (
[ItemID] [int] NULL ,
[StartDate] [datetime] NULL ,
[EndDate] [datetime] NULL ,
[Status] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO

INSERT INTO Item_TBL(ItemID, Status) VALUES('25', NULL)
INSERT INTO Item_TBL(ItemID, Status) VALUES('26', NULL)
INSERT INTO Item_TBL(ItemID, Status) VALUES('27', NULL)

UPDATE Item_TBL
SET Status='TRUE'
WHERE ItemID='26'




mr_mist
Grunnio

1870 Posts

Posted - 2003-01-13 : 11:08:51
quote:

Is there anyway to populate existing values in the Items_TBL which have the status="TRUE" After I create the Trigger



Force the trigger to fire?

update Items_TBL set status='true' where status='true'

?

-------
Moo.
Go to Top of Page
   

- Advertisement -