Can I use SQL Server to create a txt file on the c drive. Can sql server do nay kind of file handling. Is there a command that i can use in my background job to automatically create a txt file that will show data from a particular table.
Never done it before .. Any ideas...
Help is appreciated.
ThanksIn the job step, choose type as OS command(CmdExec), in the command box, type:
osql -E -Q"select top 10 * from sysobjects" -o"c:\output.txt"
The output file is a txt format having the 10 rows in sysobjects table.|||or bcp, dts or echo|||I am using BCP and it works just fine. I get a txt file with tab seperated fields. Can i specify the character positions or lengths of each field so that all my fields line up at the same positions.
Help is appreciated.
I created a stored procedure with the below
declare @.filename varchar(50),
@.bcpcommand varchar(2000)
set @.filename = 'c:\report\media.txt'
print @.filename
set @.bcpcommand = 'bcp "select * from table" queryout "'+ @.filename -U -P'
exec master..xp_cmdshell @.bcpCommandsql
Showing posts with label drive. Show all posts
Showing posts with label drive. Show all posts
Sunday, March 25, 2012
Saturday, February 25, 2012
Creating new backup device
I need to create a new backup device. I have installed a
USB drive, and would like to backup a database to it.
However, SQL Server can only see one of the drives
available on the machine when I try to create the new
device. How can I make a new backup device to a different
drive letter?
Can you try creating a dump device using sp_addumpdevice from Query Analyzer
and see if that solves the problem? See SQL Server Books Online for more
information.--
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
"onemoreshot" <anonymous@.discussions.microsoft.com> wrote in message
news:7fa201c484ae$4c09e7b0$a401280a@.phx.gbl...
I need to create a new backup device. I have installed a
USB drive, and would like to backup a database to it.
However, SQL Server can only see one of the drives
available on the machine when I try to create the new
device. How can I make a new backup device to a different
drive letter?
|||In other words, it can't be done through Enterprise
Manager? Thanks .
>--Original Message--
>Can you try creating a dump device using sp_addumpdevice
from Query Analyzer
>and see if that solves the problem? See SQL Server Books
Online for more
>information.--
>HTH,
>Vyas, MVP (SQL Server)
>http://vyaskn.tripod.com/
>
>"onemoreshot" <anonymous@.discussions.microsoft.com> wrote
in message
>news:7fa201c484ae$4c09e7b0$a401280a@.phx.gbl...
>I need to create a new backup device. I have installed a
>USB drive, and would like to backup a database to it.
>However, SQL Server can only see one of the drives
>available on the machine when I try to create the new
>device. How can I make a new backup device to a different
>drive letter?
>
>.
>
|||If it is a proper drive, then you should be able to do it in EM also. I am
just trying to narrow down the problem, by trying this in Query Analyzer.
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
<anonymous@.discussions.microsoft.com> wrote in message
news:8be201c48592$81ec8f60$a401280a@.phx.gbl...
In other words, it can't be done through Enterprise
Manager? Thanks .
>--Original Message--
>Can you try creating a dump device using sp_addumpdevice
from Query Analyzer
>and see if that solves the problem? See SQL Server Books
Online for more
>information.--
>HTH,
>Vyas, MVP (SQL Server)
>http://vyaskn.tripod.com/
>
>"onemoreshot" <anonymous@.discussions.microsoft.com> wrote
in message
>news:7fa201c484ae$4c09e7b0$a401280a@.phx.gbl...
>I need to create a new backup device. I have installed a
>USB drive, and would like to backup a database to it.
>However, SQL Server can only see one of the drives
>available on the machine when I try to create the new
>device. How can I make a new backup device to a different
>drive letter?
>
>.
>
USB drive, and would like to backup a database to it.
However, SQL Server can only see one of the drives
available on the machine when I try to create the new
device. How can I make a new backup device to a different
drive letter?
Can you try creating a dump device using sp_addumpdevice from Query Analyzer
and see if that solves the problem? See SQL Server Books Online for more
information.--
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
"onemoreshot" <anonymous@.discussions.microsoft.com> wrote in message
news:7fa201c484ae$4c09e7b0$a401280a@.phx.gbl...
I need to create a new backup device. I have installed a
USB drive, and would like to backup a database to it.
However, SQL Server can only see one of the drives
available on the machine when I try to create the new
device. How can I make a new backup device to a different
drive letter?
|||In other words, it can't be done through Enterprise
Manager? Thanks .
>--Original Message--
>Can you try creating a dump device using sp_addumpdevice
from Query Analyzer
>and see if that solves the problem? See SQL Server Books
Online for more
>information.--
>HTH,
>Vyas, MVP (SQL Server)
>http://vyaskn.tripod.com/
>
>"onemoreshot" <anonymous@.discussions.microsoft.com> wrote
in message
>news:7fa201c484ae$4c09e7b0$a401280a@.phx.gbl...
>I need to create a new backup device. I have installed a
>USB drive, and would like to backup a database to it.
>However, SQL Server can only see one of the drives
>available on the machine when I try to create the new
>device. How can I make a new backup device to a different
>drive letter?
>
>.
>
|||If it is a proper drive, then you should be able to do it in EM also. I am
just trying to narrow down the problem, by trying this in Query Analyzer.
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
<anonymous@.discussions.microsoft.com> wrote in message
news:8be201c48592$81ec8f60$a401280a@.phx.gbl...
In other words, it can't be done through Enterprise
Manager? Thanks .
>--Original Message--
>Can you try creating a dump device using sp_addumpdevice
from Query Analyzer
>and see if that solves the problem? See SQL Server Books
Online for more
>information.--
>HTH,
>Vyas, MVP (SQL Server)
>http://vyaskn.tripod.com/
>
>"onemoreshot" <anonymous@.discussions.microsoft.com> wrote
in message
>news:7fa201c484ae$4c09e7b0$a401280a@.phx.gbl...
>I need to create a new backup device. I have installed a
>USB drive, and would like to backup a database to it.
>However, SQL Server can only see one of the drives
>available on the machine when I try to create the new
>device. How can I make a new backup device to a different
>drive letter?
>
>.
>
Subscribe to:
Posts (Atom)