由于SQL Server的OSql工具只认ANSI和Unicode, 不认UTF8, 所以尽量把Visual Studio的.sql文件用Unicode保存.

方法是修改SQL模版的encoding, 另存为Unicode格式, 文件模版的位置: \Microsoft Visual Studio 9.0\Common7\Tools\Templates\Database Project Items

 

CMD.exe不认Unicode? 我的机器上是这样的:(, 只好把所有的.bat改成ANSI

 

------------------------------------------用脚本重建数据库 RebuildDatabase.bat ------------------------------------------

REM @echo off
SET uid=sa
SET pwd=sa
SET db=YOUR_DATABASE_NAME
SET server=.
SET workingDrive=E:
SET workingPath=YOUR DIR

%workingDrive%
cd %workingPath%

dir *.sql /B sortorder N /s | sort > filelist.txt

for /f "tokens=*" %%a in (filelist.txt) do (
    osql  -S %server% -U %uid% -P %pwd% -d %db% -i "%%a"
)
del filelist.txt 
 

相关文章:

  • 2021-11-13
  • 2022-12-23
  • 2021-11-19
  • 2022-12-23
  • 2021-06-12
  • 2021-06-17
  • 2021-06-17
  • 2021-03-04
猜你喜欢
  • 2022-12-23
  • 2021-06-19
  • 2022-01-21
  • 2022-12-23
  • 2021-08-02
  • 2022-01-03
  • 2021-06-20
相关资源
相似解决方案