???SQLCMD??SQL Server??ж?????
???????????? ???????[ 2012/12/24 10:19:56 ] ????????
??????????
???????DBA???????????????????SQL????????????????????????????????????????????????DBA??е????????????м????sql????????????????????????????????????????????????????????????????????洢?????????????????????????н???????3???????????????????????????????????й???Σ??????????????????????????????
?????????????
????????????????????????????
????1?????????????????????????????
????2???????????С???????У???????????????????????????????????????Σ???????????С?
????3?????????????????????????????????
???????SQLCMD??SQLServer????ж???????
????SQLCMD????? sqlcmd ??ù????????????????????????? SQLCMD ???μ?“???????”?С??? Windows ???????л????? SQL Server ?????????????? ??Cmd.exe?? ????????????? Transact-SQL ????????????????? ????ù?????? ODBC ??? Transact-SQL ??????????????MSDN????????????????????????????????
????SQLCMD????????????????:r???????SQLCMD???Сд??е??????r????????????SQL????????????SQLCMD???????????????????????????y???С????????????????????????????μ????????????ù???????????????λ?á?????????r???????????????????ж????????????????????????????????????????????н?????????????GO????????2005???????SQLCMD????????????????osql?????????????SQLCMD???????????????????????????T-SQL??????????????й????
?????????????У?????5????????TestDB????????й?????sql?????????????????CREATE_DB.sql????????????????TestDB???????????????????4??????????????????r?????????????????????????????????????洢?????????????.bat?????????????????SQLCMD???
?????????????????????C???μ?????У?C:Scripts?????????????????????У?
???????1??CREATE_DB.sql
/* SCRIPT: CREATE_DB.sql */
/* ????TestDB????? */
-- This is the main caller for each script
SET NOCOUNT ON
GO
PRINT '???????TestDB?????'
IF EXISTS (SELECT 1 FROM SYS.DATABASES WHERE NAME = 'TestDB')
DROP DATABASE TestDB
GO
CREATE DATABASE TestDB
GO
:On Error exit
:r c:ScriptsCREATE_TABLES.sql
:r c:ScriptsTABLE_INSERTS.sql
:r c:ScriptsCREATE_INDEXES.sql
:r c:ScriptsCREATE_PROCEDURES.sql
PRINT '???????'
GO
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11