SQL Split AWK Script

Split the output from SQL Server Management Studio (SSMS) > View > Object Explorer Details > “Script {function|view|procedure} as” into individual files
Note: The current RegEx’s are tailored around the following scripting options (see comments to change):

  • “Include descriptive headers” = true  (this is the default after SSMS 2008 install) – located under:  SSMS > Tools > Options > SQL Server Object Explorer > Scripting > General scripting options)
  • “Schema qualify object names” =  false (NOT the default) – under: … > Object scripting options

Download GAWK.exe for Windows: link1, link2