473,408 Members | 2,888 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Update date

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)
Jul 2 '07 #1
1 2570
r035198x
13,262 8TB
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)
One method is to use a trigger.
Jul 2 '07 #2

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

Similar topics

3
by: Ken Bush | last post by:
How can I write an update query that removes part of a field? Like if I have a field with values such as 8/3/68 (a birthday obviously) and I need to put values in a new column but I need...
3
by: rrh | last post by:
I am trying to update a field in one table with data from another table. The problem I'm running into is I need to base the update on a range of data in the 2nd table. Table 1 has: date field...
3
by: BlackFireNova | last post by:
This concerns an Access 2002 (XP) database. There are two fields, "Notes" (Memo Field) and "Notes Update" on a form (among others) which I am concerned with here. Problem: I need to be able...
2
by: nadmasl | last post by:
I have an MS Access form, where a user enters the date by selecting it from three combo boxes for day, month and year. I convert it to 11-Jan-2004 format and attempt to write to the table with an...
8
by: Maxi | last post by:
There is a lotto system which picks 21 numbers every day out of 80 numbers. I have a table (name:Lotto) with 22 fields (name:Date,P1,P2....P21) Here is the structure and sample data: ...
1
by: Riley DeWiley | last post by:
I have an UPDATE query that is always setting 0 records. When I cut and paste the SQL into Access and use it, it fails in the same way unless I coerce the date fields to be '=now()', in which case...
25
by: Neo Geshel | last post by:
This works: <form> <asp:TextBox id="name" /> <%= name.ClientID %> </form> But this DOES NOT work: <form>
31
by: Lag | last post by:
Having a problem updating my database from a web page, through a submission form. Can anyone help? ----THIS IS MY CODE IN update.php----(user, pass, and database are typed in directly, I...
2
osward
by: osward | last post by:
Hello there, I am using phpnuke 8.0 to build my website, knowing little on php programing. I am assembling a module for my member which is basically cut and paste existing code section of...
2
by: sirdavethebrave | last post by:
Hi guys - I have written a form, and a stored procedure to update the said form. It really is as simple as that. A user can go into the form, update some fields and hit the update button to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.