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 |
|
Rika1976
Starting Member
5 Posts |
Posted - 2005-01-14 : 16:43:06
|
| Okay, so heres the situation. About every hour I feed data from a que table into a larger database. Everyhour during business hours 25000 rows are loaded and after business hours, 50000 rows are loaded per hour, per run. This is deteremined by an if statement in a stored procedure before the SQL Query.If Convert(char,getdate(),114) > '18:00:00:000' BEGINSET ROWCOUNT 50000ENDELSEBEGINSET ROWCOUNT 25000ENDNow the issue is not only time, but what data goes in. I only want data loaded during the day that does not have 'Maint' in the field MU_PCIP. The only thing I can think of is putting an If statement in the Where statement of the larger SQL query that actually selects all the fields to be uploaded. Is this even possible? Any suggestions would be great! Thanks.Erika |
|
|
ehorn
Master Smack Fu Yak Hacker
1632 Posts |
Posted - 2005-01-14 : 16:58:55
|
How about something like:declare @MU_PCIP varchar(5)If Convert(char,getdate(),114) > '18:00:00:000' BEGINSET ROWCOUNT 50000SET @MU_PCIP = nullENDELSEBEGINSET ROWCOUNT 25000SET @MU_PCIP = 'Maint' ENDINSERT <table>SELECT <columns>FROM <table>WHERE (@MU_PCIP IS NULL) OR (@MU_PCIP IS NOT NULL AND MU_PCIP != @MU_PCIP) |
 |
|
|
Rika1976
Starting Member
5 Posts |
Posted - 2005-01-14 : 17:19:27
|
| Awesome!! That worked perfectly.Thanks!!Erika |
 |
|
|
|
|
|