Using SQLCMD Utility for Query Resultset Data Export as a File

preview_player
Показать описание
This video is part of a SSIS Project - "Generate Extracts based on queries of a table".
In this video, you will learn how to use SQLCMD SQL Server Command line Utility to export query result as a text file.
Please follow the playlist in a sequential order to under stand the project better.
Thanks!
Рекомендации по теме
Комментарии
Автор

Thank you very much for the tutorial :) keep it up please thank you. subscribed already

ARCI
Автор

Thanks for your video. A possibly easier method to remove the second line (and keep existing column headers, if there are numerous ones) would be to use a subsequent SED command, which is available from CygWin64 and GnuWin32, then move the results upon the original path:
SED 2d 'current file path and name' > 'revised file path and name' & move /y 'revised file path and name' 'current file path and name'

Or better yet, just append the following at the very end of the SQLCMD command (after the 'localhost' options):
&& SED -i 2d 'current file path and name'

borbetomagus
Автор

English is not my native language. When I run the batch, the information is only displayed in one column in my csv file and not in different ones like in your case. Could you help me?

krubioc
Автор

Hi, great tutorial, I would like to know if I can use this command to export in .xlsx format. Thanks

dianatorrontegui
Автор

instead of using sqlcmd you can also select the whole output and save as csv in your local machine. both serves the same purpose

hasanmosharrof
Автор

Nice post, is there way to delete the file using sqlcmd without using xp_cmdshell? Please share the link if you know about it

alextomislav
visit shbcf.ru