標籤:無法刪除資料庫 "#Test",因為該資料庫當前正在使用--查詢分析器中執行下面的語句就行了. use master go declare @dbname sysname set @dbname=‘DB1‘ --這個是要刪除的資料庫庫名 declare @s nvarchar(1000) declare tb cursor local for select s=‘kill ‘+cast(spid as varchar)&
標籤:?1,查看資料庫的版本select @@version2,查看資料庫所在機器作業系統參數exec master..xp_msver查看資料庫啟動的參數sp_configure查看資料庫啟動時間select convert(varchar(30),login_time,120) from master..sysprocesses where spid=1查看所有資料庫名稱及大小sp_helpdb查看所有資料庫使用者登入資訊sp_helplogins3,.查看某資料庫下某個資料對象的大小sp_
標籤:想要將值插入到自動編號(或者說是識別欄位,IDENTITY)中去,需要設定 SET IDENTITY_INSERT樣本:1.首先建立一個有識別欄位的表:CREATE TABLE products (id int IDENTITY PRIMARY KEY, product varchar(40))2.嘗試在表中做以下操作:INSERT INTO products (id, product) VALUES(3, ‘garden shovel‘)結果會導致錯誤:“當
標籤:SQLSERVER:通過sys.tables實現批量刪表,或者復原表 1 begin try 2 drop table #temp10 3 end try 4 begin catch 5 end catch 6 7 select ‘drop/*truncate*/ table tuning.‘+name as droptable,ROW_NUMBER() over(order by name) as rownumber 8 into #temp10 9 from
標籤: 複製:將資料轉送到其他伺服器上儲存,做備份。鏡像:主伺服器資料庫掛了,另一台自動成為主伺服器運行,日誌:可控制的鏡像。叢集:主伺服器掛了,另一台自動成為主伺服器運行,並不僅限於資料庫。明細:引自http://hi.baidu.com/jaimy_jie/blog/item/6e099ed52f42a4d250da4b24.html一, 資料庫複寫SQL Server 2008資料庫複寫是通過發布/訂閱的機制進行多台伺服器之間的資料同步,我們把它用於資料庫的同步備份。
標籤: 讀取的記錄檔來自安裝目錄下:MSSQL\Log\ERRORLOG--This will hold the rowsCREATE TABLE #ErrorLog (LogDate datetime, ProcessInfo VarChar(10), ErrorMessage VarChar(Max))-- Dump the errorlog into the tableINSERT INTO #ErrorLogEXEC