April 13, 2009 at 10:33 am
File from SQL Server 2005 Express....
Server Name: AD-20\SQLEXPRESS
DataBase: MMS
Table: DataFile (Fields are First Name, Last Name, Address and PhoneNumer)
File to Local System.......
File Path: 'C:\AA\DataFile.csv'
I try cuople of days on net which showing BCP method but that was not working......... I need your help. Is anyone help me about it.
xp_cmdshell 'bcp "SELECT * FROM [mms].dbo.[datafile]" queryout "C:\Customer.csv" -c -b 100000 -t, -T -S01eq23019\sqlexpress'
This is not working ........ Please some one assistme . Though I have insert bult of data from Local Sytem to SQL Server 2005 using Procedure.
But not able to export this data file to Local System
May 31, 2009 at 1:28 pm
Hi,
I used the below query to BCP out to a csv file successfully. SQL version is SQL 2008 Express running on Windows XP SP2. I've replaced the DB name, table name and hostname with "xxxx's". All you will have to do is replace with your specific data to run the query.
USE master
GO
EXEC xp_cmdshell 'bcp "SELECT * FROM [xxxxxx].dbo.[xxxxxxx]" queryout "C:\Customers.csv" -c -b 10000 -t , -T -S xxxxxxx\SQLEXPRESS'
May 31, 2009 at 4:51 pm
In addition, if you use the -T flag for a trusted connection, you may have to enable 'Named Pipes' protocol.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply