question

ing_choy avatar image
ing_choy asked

SQLCMD to export data in xls file

Hola Team

Necesito obtener a traves de un 'Select' el resultado en archivo excel con su encabezado.

---Ejemplo01: aqui se obtiene el xls peso solo muestra en una fila.

C:\PruebaXLS>sqlcmd -S GCTEST -d PracticeDB -E -Q "SELECT id,Nombre,Apellido,Dieccion,Distrito from EMPLEADO" -o result.xls

Ejemplo2: Aqui si muestra la data pero con diferentes columnas pero solo en archivo CSV,(lo necesito en Excel).

C:\PruebaXLS>sqlcmd -S localhost -E -i PRUEBA01.sql -o result.csv -h-1 -s "," -w 700

sqlcmdexport
ejemplo01.png (236.6 KiB)
ejemplo02.png (225.1 KiB)
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.