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
 Transact-SQL (2000)
 select into a file

Author  Topic 

warmnfuzzy
Starting Member

10 Posts

Posted - 2005-06-03 : 10:59:52
I am new to SQL Server, but an old pro and SQL. I am having a bit of a problem trying to select from a table into a file. Any suggestion would be appreciated. Previously I would have used a statement like
unload to 'c:\test.txt'
select * from testtable

but apparently this is not how you do things anymore.

Thanks!

I never go to sleep or I forget everything!

X002548
Not Just a Number

15586 Posts

Posted - 2005-06-03 : 11:07:08
You don't mentio what your background is...it ain't Oracle...is this UDB?

Do you have SQL Server Client tools installed?

You need to look up bcp in Books Online...

But here's a simple syntax

EXEC master..xp_cmdshell 'bcp Northwind.dbo.Orders out c:\Orders.txt -Sservername -UuserId -Ppassword -c'



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page
   

- Advertisement -