Microsoft
Software
Hardware
Network
Question : SQL - Copy todays records from one table to another table (Scheduled)
Using MSSQL 2003. I need to copy all records from 'table1' where field value 'todaysdate' = (the current day) to 'table2'. I would like to schedule this to occur every night @ 11pm. How could this be done?
Answer : SQL - Copy todays records from one table to another table (Scheduled)
HI
1) write a text file insert.sql (replace <> with needed values) , see code snippet
2) create a BAT file insert.cmd that has the following line:
/sqlcmd -S
-d
-U
-P
-i insert.sql
3) Test the batch file by running it manually
4) Use windows scheduler to run the batch file each day at 11 PM
See
http://www.iopus.com/guide
s/winsched
uler.htm
for details
1: 2: 3:
insert into table2 (select * from table1 where todaysdate = getdate()) go
Open in New Window
Select All
Random Solutions
SQL Query Help needed - The text, ntext, or image data type cannot be selected as DISTINCT.
show record field in textbox
Closing Computer Management (MMC) creates an error: Application popup: mmc.exe
Apache webserver keeps stopping
Exchange 2003 - Messages stuck on "Messages Pending Submission"
Text count in excel worksheet
In a SQL Server 2008 Express stored procedure can you return a rowset and an output parameter?
CSV
SBS2008 exchange 2007 antispam block logs ? Where are they.
Conditional formatting for multiple values in Access Datasheet