August 28, 2008 at 10:09 am
I have a table that i need to check at the end of each month. If the date field is older that the current month and day i need to change a number (add one to it) and then update the recorded if it does not already exist. I have about 5 fields in each row that will have the same number that needs to change. What is the easiest way to do this.
example
id desc date name title
xxx8=nnn 2008-testdata 200808 bob mr08
yyy8=ttt 2008-testdata2 200808 betty mrs08
xxx9=nnn 2009-testdata 200908 bob mr09
so if i select the date older that sept 2008 i will return the top 2 rows. I want to change the 8 to a 9 except for the month (08) in the date field.
so it would be:
id desc date name title
xxx9=nnn 2009-testdata 200908 bob mr09
yyy9=ttt 2009-testdata2 200908 betty mrs09
well the first record already exist so i don't want to update I can just delete it. I need to add/update the second record to the table.
Does this make any sense? What is the easiest way to accomplish this?
Thanks
August 28, 2008 at 10:17 am
Is this a char field? Can you use Substring to build something up?
August 28, 2008 at 11:25 am
it is a varChar. I need to look into the substring i guess.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply