osql and passing variable

Posted on 2009-02-11
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
    LVL 15

    Accepted Solution

    Use SSIS package instead of your osql statement.

    Author Comment

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

    LVL 15

    Expert Comment

    A little example about using variables

    Author Closing Comment

    Thank you.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Suggested Solutions

    In this article—a derivative of my blog post (—I will explore a few different perspectives on which week today's date falls within using Microsoft SQL Server. First, to frame this stu…
    Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
    Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
    Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

    759 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

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now