I been trying to figure out how to do this for a while but finally given in and decided to ask here.
I am using SQL express and I think that desnt support automation of SQL scripts (please correct me if I am wrong!)
I want to run a backup script and the plan was to use a bat file and windows task scheduler. But for the life of me I cannot get the bat file to work after trying loads of different example from my searches.
hmm does it have to be called sqlcmd.exe?
I had a file called script.bat and i was writing a one line command to execute the SQL script. I really dont have any idea what im doing I was just following what some forums were saying when I searched
I'm guessing here but I would say that you can pass parameters to sqlcmd.exe can you not? So you could call sqlcmd.exe <parameter1> <parameter2> ... from your batch file and it should run your backup commands for you.
Bear in mind that your batch script needs to know where the sqlcmd is run from. So it either needs to be in your PATH setting or you need to run your batch script from the same directory (not advisable).
You might want to take a step back and make yourself familiar with the SQL Server environment and all the tools that come with it before trying to actually implement something.
Sometimes it's quicker to read the manual first and only then start "coding", instead of trying to cleanup the mess you made because you "don't have any idea what you are doing".