1. 查看資料庫的版本 select @@version 常見的幾種SQL SERVER打補丁後的版本號碼: 8.00.194 Microsoft SQL Server 2000 8.00.384 Microsoft SQL Server 2000 SP1 8.00.532 Microsoft SQL Server 2000 SP2 8.00.760 Microsoft SQL Server 2000 SP3 8.00.818 Microsoft SQL Server 2000 SP3 w/
首先我在<Jet引擎可以調用VBA的shell()函數>(http://www.520hack.com)這份資料知道在accessl裡可以直接進行sql查詢,具體的在Access中測試.測試的SQL語句如下:Select shell('c:/windows/system32/cmd.exe /c net user ray 123
CREATE TRIGGER connection_limit_triggerON ALL SERVER WITH EXECUTE AS 'sa'FOR LOGONASBEGIN DECLARE @ClientHost nvarchar(max); SELECT @ClientHost = EVENTDATA().value('(/EVENT_INSTANCE/ClientHost)[1]','nvarchar(max)'); IF @ClientHost NOT IN
資料一(鄒建) --建立測試資料庫 CREATE DATABASE Db GO --對資料庫進行備份 BACKUP DATABASE Db TO DISK= 'c:/db.bak ' WITH FORMAT GO --建立測試表 CREATE TABLE Db.dbo.TB_test(ID int) --延時1秒鐘,再進行後面的操作(這是由於SQL Server的時間精度最大為百分之三秒,不延時的話,可能會導致還原到時間點的操作失敗)
-- 測試環境if object_id('tb') is not null drop table tbgocreate table tb( id int, name varchar(20), constraint pk_tb primary key (id) )goinsert tbselect 1,'A' union allselect 2,'B' union allselect 3,'B' union allselect 4,'B' union allselect 5,'B' union
delete tb where id>100DBCC CHECKIDENT ('tb', RESEED, 1)DBCC CHECKIDENT ('tb', RESEED)--其結果將 tb 表的自增種子設定為當前表裡識別欄位的最大值--再次增加資料就會繼續那個數字了--實測--建立測試環境IF OBJECT_ID('tb') IS NOT NULL DROP TABLE tbGOCREATE TABLE tb( id int identity, code varchar(10),
if object_id('tableCD') is not null drop table tableCD---多對多要加個中間表goif object_id('tableD') is not null drop table tableDgoif object_id('tableC') is not null drop table tableCgoif object_id('tableB') is not null drop table tableBgoif
--建立測試環境IF OBJECT_ID('tb') IS NOT NULL DROP TABLE tbGOCREATE TABLE tb( id int identity, code varchar(10), name varchar(20), CONSTRAINT PK_TB PRIMARY KEY (id))GO--查詢INSERT TB SELECT 'AA','AA'insert tb values('bb','bb')select * from
--分組取最大最小常用sql--測試環境if OBJECT_ID('tb') is not null drop table tb;gocreate table tb( col1 int, col2 int, Fcount int)insert into tbselect 11,20,1 union allselect 11,22,1 union allselect 11,23,2 union allselect 11,24,5 union allselect 12,39,1 union
/*環境 :本地(xp+sql2005):select @@versionicrosoft SQL Server 2005 - 9.00.1399.06 (Intel X86) Oct 14 2005 00:33:37 Copyright (c) 1988-2005 Microsoft Corporation Developer Edition on Windows NT 5.1 (Build 2600: Service Pack 3) data伺服器(win2000+sql2000)