回复 1# liuxinzhong
應該不用動到查詢器吧
Dim $Server = "SERVER"
Dim $Company = "DBASE01"
$conn = ObjCreate("ADODB.Connection")
$RS = ObjCreate("ADODB.Recordset")
$conn.Open ("driver={SQL Server};server="&$Server&";uid=sa;pwd=dsc;database="&$Company);主機名IP127.0.0.1,UID=用戶,PWD=密碼,database=資料庫名 ※
$RS.ActiveConnection = $conn
$conn.Execute("use master ")
$conn.Execute("sp_configure 'allow updates',1")
$conn.Execute("update sysdatabases set status=-32768 where dbid=DB_ID('pos')")
$conn.Execute("dbcc rebuild_log('pos','D:\database\MSSQL\Data\pos_log.ldf')")
$conn.Execute("dbcc checkdb('pos')")
$conn.Execute("sp_dboption 'pos','dbo use only','false'")
$conn.Execute("sp_configure 'allow updates',0")
$conn.Execute("reconfigure with override ")
|