January 14, 2008 at 10:46 pm
I've currently got the following script.
sqlcmd -S dbinstance -U user -P pass -i input.sql -o file.CSV -s"," -h -1 -W
Which works fine except that I need the CSV file to have only the valures from the select statement from input.sql
Its displaying like follows
Changed database context to 'DBNAME'.
12410617,A Labs
12410617,101 L 1 South
12410617,B Store Room
(3 rows affected)
Can you change the encoding as well? like from ANSII to something else, i've got a fussy application at current which only works with CSV file exported from Query Analyzer 2000.
Thanks in advanced who ever helps.
January 15, 2008 at 12:38 am
you could off course immediatly connect to the correct database
- add -d yourdbname to the commandline
- add set nocount on at the beginning of your script to avoid the nnn rows affected.
Check BOL
first glimps : SQLCMD /? gives more info
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data and code to get the best help
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Who am I ? Sometimes this is me but most of the time this is me
January 15, 2008 at 4:41 pm
Perfect, thank you for your assistance
sqlcmd -S dbinstance -U user -P pass -i input.sql -o file.CSV -s"," -h -1 -W -d DBNAME
for those interested is the finished snippet
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply