Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
whitmoj
Yak Posting Veteran
68 Posts |
Posted - 2009-02-24 : 09:40:17
|
I wonder if any one can help me with this I have a transact that pops a tbl with yesterdays data with the following date criteria WHERE AP_LOG_DATE >= DATEADD(d, DATEDIFF(d, 0, getdate() -1), 0) and AP_LOG_DATE < DATEADD(d, DATEDIFF(d, 0, getdate()), 0). What I am wanting to do is build into this that if my first SP fails on a saturday then runs on Sunday it will still get all data but my final SP will not due to the fact it only gets yesterdays date. Is there any code I can write that will check to see if the date is there and if not will populate the table. WhitmojIf I have inspired one person today then my job is done. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-02-24 : 09:43:53
|
| does first sp populate any tables? where will this table grab data from? also does first sp store the date where it ran succesfully somewhere? |
 |
|
|
whitmoj
Yak Posting Veteran
68 Posts |
Posted - 2009-02-24 : 09:45:46
|
| The first sp grabs the data off the switch and store all info including date's of callsWhitmojIf I have inspired one person today then my job is done. |
 |
|
|
darkdusky
Aged Yak Warrior
591 Posts |
Posted - 2009-02-24 : 09:49:33
|
| If the population is an INSERT rather than an update, i.e. new rows added - it might be easier to just set a default value for the column as getdate-1, so when a new row is added it is automatically filled with yesterday's date unless otherwise specified. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-02-24 : 09:56:07
|
quote: Originally posted by whitmoj The first sp grabs the data off the switch and store all info including date's of callsWhitmojIf I have inspired one person today then my job is done.
nope. does it store any info regarding date when it ran? |
 |
|
|
whitmoj
Yak Posting Veteran
68 Posts |
Posted - 2009-02-24 : 10:03:10
|
| NoWhitmojIf I have inspired one person today then my job is done. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-02-24 : 10:06:41
|
| and table doesnt have any audit columns like date created,modifieddate etc which gets value from getdate()? |
 |
|
|
whitmoj
Yak Posting Veteran
68 Posts |
Posted - 2009-02-25 : 02:53:37
|
| No it has a date time field of the call dataWhitmojIf I have inspired one person today then my job is done. |
 |
|
|
|
|
|