April 19, 2011 at 4:23 am
Hi All,
Sorry if the query exists previously.
I would like to transfer data from SQL Server to flat file by using stored procedure.
Current scenario uses bcp executed via xp_cmdshell. The alternate is required as they are converted to SQL Server 2008 and also, the extended procedures will not be permitted to execute.
Please let me know on BULK EXPORT from SQL Server table to flat file.
Thanks in advance
Priya
Regards
Priya
April 19, 2011 at 4:58 am
You could create an SSIS package to export the data to a flat file.
To call it from a stored procedure without requiring cmdshell, you could add it as a SQL Agent job and start the job within the procedure.
April 19, 2011 at 3:48 pm
Unfortunately BULK EXPORT does not exist. Please vote for the suggestion here:
http://connect.microsoft.com/SQLServer/feedback/details/224026/sql-engine-bulk-export-command
There are no special teachers of virtue, because virtue is taught by the whole community.
--Plato
April 19, 2011 at 4:49 pm
Have you tried OPENROWSET ? I know it works on 2005, but have as yet not tested on 2008
/*Text file must exist and have a first line of comma separated field names*/
INSERT INTO OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Text;Database=F:;HDR=Yes;', 'SELECT * FROM Test.txt')
SELECT * FROM Keywords
Sample of output from Test.txt
Keywordid, keyword
"1","Discs"
"2","freespace"
"3","drives"
"4","UTC"
Test.txt = existing file with comma seperated column names of my table
Keywords = my existing tables name
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply