:r
Read additional SQL into a sqlcmd script.
Syntax at a glance
:r filename
Work example
Split lab setup and verification into files
Put a short SELECT in a lab file and include it from your main sqlcmd script. Run from the directory holding those files.
Check your work The included SELECT appears at the expected position in the script run.
Open Microsoft Learn for full syntax, permissions, and details for your version.