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
 General SQL Server Forums
 New to SQL Server Programming
 Export to flat files

Author  Topic 

kmsql
Starting Member

4 Posts

Posted - 2007-04-13 : 11:39:53
How can I export data from sql server 2005 table to fixed length flat file without using xp_cmdshell option from sql server stored procedure ?

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2007-04-13 : 12:11:57
try the DTS. right click on the DB -> All Tasks -> Export Data. Follow the wizard.


************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-04-13 : 12:26:31
You can try BCP as well, if you prefer command-line like me.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

kmsql
Starting Member

4 Posts

Posted - 2007-04-13 : 13:11:48
Thanks for you replies.
But the problem is I need this to be done using sql query from a stored procedure. I cannot use DTS or bcp. Executing windows commands from sql server is restricted here.
Go to Top of Page

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2007-04-13 : 13:14:22
Then your only option I can think of is through an application. Write up a small VB tool, call the proc to return the result set, create a file through the app. Should be fairly easy.


************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

kmsql
Starting Member

4 Posts

Posted - 2007-04-13 : 13:20:36
Thanks.
I'm new to those stuffs.
Could you help me with sample code snippets or some help documents for doing it.
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2007-04-13 : 13:41:58
ooo...ooo...can I play?


http://www.sqlusa.com/bestpractices2005/directexport/



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

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-04-13 : 13:54:48
You're bad Brett. Bad


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -