Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
vendors:microsoft:sql:sqlcmd [2024/05/14 14:16] – created gerardorourkevendors:microsoft:sql:sqlcmd [2024/05/14 17:42] (current) gerardorourke
Line 4: Line 4:
  
  
 +<code>
 +sqlcmd -S MyServer -d myDB -E -Q "select col1, col2, col3 from SomeTable" 
 +       -o "MyData.csv" -h-1 -s"," -w 700
 +-h-1 removes column name headers from the result
 +-s"," sets the column separator to ,
 +-w 700 sets the row width to 700 chars (this will need to be as wide as the longest row or it will wrap to the next line)
 +</code>
 +Reference: https://stackoverflow.com/questions/425379/how-to-export-data-as-csv-format-from-sql-server-using-sqlcmd
  
 +==== TEMP ====
 +  *https://stackoverflow.com/questions/2731868/powershell-align-right-for-a-column-value-from-select-object-in-format-table-fo
  • vendors/microsoft/sql/sqlcmd.1715692595.txt.gz
  • Last modified: 2024/05/14 14:16
  • by gerardorourke