How to install Database using commandline prompt

osql.exe -S %TARGETSERVER% -E -d Northwind -Q"select db_id()" > nul
if %errorlevel% == 0 (
    @echo.
    @echo Northwind DB already exists.
    @echo.
    goto end
)
@echo.
@echo Creating Northwind DB ...
@echo.
osql.exe -S !TARGETSERVER! -E -n -i !WORKINGDIR!\instnwnd90.sql


:end

原文地址:https://www.cnblogs.com/liunatural/p/1519368.html