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)
 Copy data from SQL Server into Tex file

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-01-20 : 07:11:31
mark writes "how to run sp or query from sql server into text file?

SQL Server: Developer
Login: sa
Password: test
Database: PerInfo
Table: Name_tbl

I need to send information into txt file "select id,last,first from name_tbl" from SQL Server.

Thanks"

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-01-20 : 14:46:49
You can use DTS or bcp.exe for this. You could use the Import/Export wizard as well, but that's just a subset of DTS anyway. Let us know which tool you'll be using then we can offer some help on it if you need it.

Tara
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2005-01-20 : 16:49:55
Well at least it's not blank



Brett

8-)
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2005-01-20 : 19:53:05
exec master..xp_cmdshell 'bcp "select id,last,first from PerInfo..name_tbl queryout c:\myfile.txt -Usa -Ptest -c'


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -