Reputation: 781
I get a zipped file of sql dumps everyday. I unzip it, and then run this script everyday using a task scheduler to update the database.
@echo off
ECHO %USERNAME% started the batch process at %TIME% >output.txt
for %%f in (C:\Users\Desktop\Crash\*.sql) do (
sqlcmd.exe -S HUTRC1-HP -U sa -P hutrc@2121 -d test -i %%f >>output.txt)
exit
The database doesn't however get updated all the time. Let's just say it is not very reliable. There are some days when it is current, and other days when it's not current. Can't explain why. Is there more efficient script to update the database with? Preferably in powershell.
Upvotes: 0
Views: 344
Reputation: 568
Creating an SSIS package will help you and achieve all that you want with better error handling.
There are multiple articles out there and a bunch of youtube videos. A youtube video can help you accomplish what you need in no time. Here are some articles that i quickly got off of msdn.
How to create an SSIS package.
How to unzip files in SSIS package without any C# knowledge
How to automate an SSIS package.
Hope this helps.
Upvotes: 1