Quantcast
Channel: Questions in topic: "variables"
Viewing all articles
Browse latest Browse all 49

Is it possible to roll back a date when a field ID changes?

$
0
0
![alt text][1] Greetings all, I am needing to know is it possible in SQL Server 2008 R2 to make a date change as a particular row id changes? I have to recreate a sales import process. I always grab the max id for the previous date (getdate() - 1). I am currently doing this in FileMaker Pro Advanced 11.2, but my company is migrating from FileMaker Pro Advanced 11.2 to SQL Server 2008 R2. I am currently using SQL Server R2 to recreate the sales import process, but I just need to know how to write a code that would change the date field when the row id changes. I have attached a file (i wrote a result set using excel just as an example) to show you all what I am trying to accomplish. On Mondays, I always run the import for the previous Friday, Saturday, and Sunday. This is why I need to know when there is a change in ID, there will be a change in date (going back) I am pretty sure that I would have to use something like getdate() -2, getdate() - 3, but I need to know how to apply this as the Id changes. as the ID decreases, the date will go back a previous day with each change. Your help would be greatly appreciated. [1]: http://ask.sqlservercentral.com/storage/temp/102-asksqlquestion.jpg

Viewing all articles
Browse latest Browse all 49

Trending Articles