July 2, 2008 at 6:24 am
Hi Folks
I am trying to do a simple query and output to a csv file.
SELECT *
FROM mytable
OUTPUT TO c:\mycsvfile.csv
Could somebody please advise why this isn't working.
I've read through loads of Forums/Suggestions, but the solutions are tooooo complicated. I want to keep it simple.
Your help is appreciated
Shodman
July 2, 2008 at 7:11 am
Hi Shodman,
perhaps something like this, with sqlcmd:
sqlcmd -S MyServer -E -Q"SET NOCOUNT ON SELECT * FROM
MyTable WHERE ... " -o Result.csv
for more information about sqlcmd read http://technet.microsoft.com/en-us/library/ms162773.aspx
[font="Verdana"]CU
tosc[/font]
July 4, 2008 at 12:27 am
Shodman (7/2/2008)
Hi FolksI am trying to do a simple query and output to a csv file.
SELECT *
FROM mytable
OUTPUT TO c:\mycsvfile.csv
Could somebody please advise why this isn't working.
I've read through loads of Forums/Suggestions, but the solutions are tooooo complicated. I want to keep it simple.
Your help is appreciated
Shodman
OUTPUT TO is not in the T-SQL language and I don't believe it's even in DMX... You need to use one of the following...
DTS
SSIS
BCP
xp_CmdShell
SQLCMD
... and they all have entries for how to use them in Books Online.
--Jeff Moden
Change is inevitable... Change for the better is not.
July 4, 2008 at 2:10 am
Thanks for your replies Guys.
I remebered in the end, Import/Export Wizard. It does exactly what I want!
Thanks again
Shodman
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply