-
INSERT INTO Text File
I am trying to SELECT various fields from a table in SQL Server to INSERT INTO a Text file defined using a Schema.ini. I know that this can be done using BCP (not sure if I could specify which fields as not all are required), DTS (which I have done) and with a Linked Server (where I keep getting a bookmark error). The process used in Access is [Sample#csv] IN 'C:\' 'TEXT;' but I can't seem to find the format to use in SQL using either a MSDASQL or ODBC connection string. Any ideas would be greatly appreciated, thanks.
-
To use BCP, you can create a view with the required columns in the required order and use this view to create the CSV file using BCP. I find a view easy to read and maintain that using a query in the BCP statement.
BCP <view_name> out <csv_file_path_and_name> -c -t',' ...(other parms)...
HTH.,.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|