sqlcmd

  • Hi,

    could any one pls help me ? am scratching my head with sqlcmd.

    this the issue

    create table testcmd (a int identity, b varchar(10))

    go

    insert into testcmd values ('a,b,c')

    running below sqlcmd

    sqlcmd -SMyservername -E -q"select b from testcmd" >"files.csv" -s"," -W -w200

    Column B has comma separated value, so in csv, it breaks upto three column.s how to do this for -s?

  • No worries. it seems worked when my developer to go for txt instead of csv.

  • SQLCMD -S YourSQLServer -d YourDatabase -U YourUserName -P YourPassword -Q "Your Query" -s "," -o "C:\Yourfilename.csv"

  • Thanks.. It worked when I used -o instead of >.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply