Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Using OSQL - Location of text files

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-08-06 : 07:59:00
Susy writes "I tried to create a textfile using a stored procedure using OSQL and redirection commands. I have the following problems
1) When I want to create the textfile to a location other than the c: drive of the sql server, I get an error "Cannot open output file - N:\osqloutput.txt". Is it possible to have a different location?

2) Can the OSQL statement be used within the procedure itself."

robvolk
Most Valuable Yak

15732 Posts

Posted - 2003-08-06 : 07:57:43
Why not use bcp? It's specifically designed to export (and import) text files from SQL Server. Books Online has more details, and it works a lot like osql does.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-08-06 : 14:00:28
Using mapped networked drives work for me when I use osql. Can you post your command?

And yes you can use OSQL in a procedure (xp_cmdshell), but why would you even want to?

Tara
Go to Top of Page
   

- Advertisement -