Run Big Sql Server File (edit)
Standardize SQL Server T-SQL Code Formatting
Online formatter: https://sql-format.com/
ApexSQL's Refactor: SQL query formatter directly into SSMS and Visual Studio for free
Using SQLCMD
You have to install the Client SDK Tools
Folder: C:\Program Files\Microsoft SQL Server\110\Tools\Binn\
File: SQLCMD.EXE
SQLCMD.EXE -S (local) -U myusername -P mypassword -d DBNAME_HERE -i "D:\3.sql"
"C:\Program Files\Microsoft SQL Server\110\Tools\Binn\SQLCMD.EXE" -S Localhost -U SAAccount -P YourPassword -d DEV -i "D:\1.sql"
"C:\Program Files\Microsoft SQL Server\110\Tools\Binn\SQLCMD.EXE" -S Localhost -U SAAccount -P YourPassword -d DEV -i "D:\2.sql"
How to export data as CSV format from SQL Server using SQLCMD?
sqlcmd -S MyServer -d MyDB -U SAAccount -P YourPassword -E -Q "select col1, col2, col3 from ATable" -o "MyData.csv" -h-1 -s"," -w 700
- -h-1 removes column name headers from the result
- -s"," sets the column seperator to the comma (,)
- -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)