By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,839 Members | 2,270 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,839 IT Pros & Developers. It's quick & easy.

Update date field

P: 5
Hi I am using MS sql right now I m felling up the data into the database using a software called DTM data generator so my problem is I have filled all the dates in 4 different columnsin a single table randomly
Now they all hav restrictions like (date A < date B) and same way (date B<date C) and (date B <date D) so what I am doing is
first I am randomly assigning the dates between 2003 till 2007
then using Sql statment like
update tablename set date B = date B +1 where dateA > date B ...so wht happens it increase the day by one which dosent help. because year does not change ...
Is there a way how should I make sure that Date A is always less than B
....if by using ......dateadd ...or update..... :( ..... i have tried things like

UPDATE incidents
SET initdt = dateadd(day,2,initdt)
WHERE initdt < incidentdt

but it will just update the date by 20 days i want that date A (initdt)should always be greater then date B (incident)
Jun 29 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.