Table Name = ColorTable
| ID | ColorSerial | ColorPart | ColorType |
| ID | ColorSerial | ColorPart | ColorType |
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Mar 11, 2012, 9:19 AM
David SmithPosted Mar 9, 2012, 11:09 PM
this works below, but once I execute the bat file I have no way of knowing when its down, what I am doing is copying all data to text files, then afterwards, delete from the database. So is there a way to know if the bat file has finished exectuting berfore deleting from the database.
process.StartInfo.UseShellExecute = false;
process.StartInfo.FileName = Directory.GetCurrentDirectory.;
if (File.Exists(RapidViewClient.Properties.Settings.Default.ExamplePath))
{
process.StartInfo.CreateNoWindow = false;
process.Start();
}
David SmithPosted Mar 9, 2012, 7:55 PM
VulpesPosted Mar 9, 2012, 11:00 AM
http://stackoverflow.com/questions/1355876/export-table-to-file-with-column-headers-column-names-using-the-bcp-utility-an
David SmithPosted Mar 9, 2012, 10:13 AM
Ok this works below from the command line, when I execute this in management studio, it is executing properly, but never writes the file to disk. But if execute the same bcp from the command line it works just find. Can some tell me why is not writing the file to local disk. And also how to include the headers from the table in the bcp, It only returns the rows and columns without the header fields.
BEGIN
DECLARE @sql varchar(8000)
SET @sql = 'bcp "SELECT * FROM ColorDatabase.dbo.ColorTable" queryout "C:\Temp\Example.txt" -c -t; -T -SXXXXXXXXXX'
Print @sql
exec master..xp_cmdshell @sql
END
VulpesPosted Mar 8, 2012, 6:41 AM
http://www.c-sharpcorner.com/Forums/Thread/161804/covert-sql-data-into-csv-file.aspx