I have table there is a status column when status is active
I have table there is a status column when status is active then data
not inserted otherwise insert. status depend on end date if enddate is
smaller than the today date then automatically status become unactive
and data will be inserted
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Oct 16, 2013, 7:20 AM EDT
Question is not clear. Please give some more detail.
Hemant SrivastavaRank #581 · 4.2K reputationPosted Oct 16, 2013, 11:33 AM EDT
DECLARE @TIME_FROM_TABLE DATETIME
SET @TIME_FROM_TABLE = (
SELECT UDT_TS AS TIMESTAMP
FROM TSTATUS
WHERE CNY_CD = 'US'
)
IF ((GETDATE()- @TIME_FROM_TABLE) > 0)
BEGIN
--SET THE STATUS COLUMN TO INACTIVE
--DO INSERT OPERATION
END
ELSE
BEGIN
--SET THE STATUS COLUMN TO ACTIVE
END
Hemant SrivastavaRank #581 · 4.2K reputationPosted Oct 21, 2013, 5:07 AM EDT