[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


osql and passing variable

Posted on 2009-02-11
Medium Priority
Last Modified: 2012-08-14
I am working at creating an osql statement to run with a SQL job, allowing it to run at a set schedule.  I will be passing the -o switch in order to force it to save to a file, but is there any way to pass a variable into the file name?
Ideally, I would want to append the date to the filename so that there is not a fear of it being overwritten.

Question by:cjmara
  • 2
  • 2
LVL 15

Accepted Solution

jorge_toriz earned 1500 total points
ID: 23619405
Use SSIS package instead of your osql statement.

Author Comment

ID: 23621475
Can you offer a suggestion on where to find some further information on SSIS?

LVL 15

Expert Comment

ID: 23624207
A little example about using variables


Author Closing Comment

ID: 31545908
Thank you.

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
MSSQL DB-maintenance also needs implementation of multiple activities. However, unprecedented errors can hamper the database management. In that case, deploying Stellar SQL Database Toolkit ensures fast and accurate database and backup repair as wel…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question