luisdev
2012-11-28 14:21:12 UTC
I'm using code like this in MSSQL 2008 R2 to pipe the results of a
select statement to a .csv file on a network share:
SET NOCOUNT ON;
GO
:OUT \\163.123.45.678\SomeFolder\myfile.csv
SELECT
id,
name,
surname
FROM
sometable;
GO
This creates the "myfile.csv" file at the correct location but there
is an extra blank line at the end of the .csv file.
How do I prevent that blank line from being created in the .csv file?
Is the above the best way to pipe the output of a sql query to a text
file?
select statement to a .csv file on a network share:
SET NOCOUNT ON;
GO
:OUT \\163.123.45.678\SomeFolder\myfile.csv
SELECT
id,
name,
surname
FROM
sometable;
GO
This creates the "myfile.csv" file at the correct location but there
is an extra blank line at the end of the .csv file.
How do I prevent that blank line from being created in the .csv file?
Is the above the best way to pipe the output of a sql query to a text
file?