»ñÈ¡sqlserverÖÐÊý¾Ý¿âµ±Ç°Á¬½ÓÊý
ÈçºÎ²é¿´SQL SERVERÊý¾Ý¿âµ±Ç°Á¬½ÓÊý
1.ͨ¹ý¹ÜÀí¹¤¾ß
¿ªÊ¼->¹ÜÀí¹¤¾ß->ÐÔÄÜ£¨»òÕßÊÇÔËÐÐÀïÃæÊäÈë mmc£©È»ºóͨ¹ýÌí¼Ó¼ÆÊýÆ÷Ìí¼Ó SQL µÄ³£ÓÃͳ¼Æ È»ºóÔÚÏÂÃæÁгöµÄÏîÄ¿ÀïÃæÑ¡ÔñÓû§Á¬½Ó¾Í¿ÉÒÔʱʱ²éѯµ½Êý¾Ý¿âµÄÁ¬½ÓÊýÁË¡£²»¹ý´Ë·½·¨µÄ»°ÐèÒªÓзÃÎÊÄÇ̨¼ÆËã»úµÄȨÏÞ£¬¾ÍÊÇҪͨ¹ýWindowsÕË»§µÇ½½øÈ¥²Å¿ÉÒÔÌí¼Ó´Ë¼ÆÊýÆ÷¡£
2.ͨ¹ýϵͳ±í²éѯ
SELECT * from
[Master].[dbo].[SYSPROCESSES] WHERE [DBID] IN ( SELECT
[DBID]
from
[Master].[dbo].[SYSDATABASES]
WHERE
NAME='DBName'
)
DBName ÊÇÐèÒª²é¿´µÄÊý¾Ý¿â£¬È»ºó²éѯ³öÀ´µÄÐÐÊý£¬¾ÍÊǵ±Ç°µÄÁ¬½ÓÊý¡£²»¹ýÀïÃ滹ÓÐһЩ±ðµÄ״̬¿ÉÒÔ×ö²Î¿¼Óá£
ÀýÈ磺Á¬µ½masterÕâ¸öÊý¾Ý¿âдÈçÏÂÓï¾ä
select * from sysprocesses where dbid in (select dbid from sysdatabases where name='MyDatabase')
½«ËùÓÐÁ¬½ÓMyDatabaseÕâ¸öÊý¾Ý¿âµÄÁ¬½Ó¼Ç¼¶¼Çó³öÀ´¡£
sysprocessesÕâ¸ö±í¼Ç¼ËùÒÔÁ¬½Óµ½SQL SERVERÊý¾Ý¿âµÄÁ¬½Ó¡£
3.ͨ¹ýϵͳµÄ´æ´¢¹ý³ÌÀ´²éÕÒ
SP_WHO 'UserName'
UserName Êǵ±È»µÇ½SqlµÄÓû§Ãû£¬Ò»°ã³ÌÐòÀïÃ涼»áʹÓÃÒ»¸öUserNameÀ´µÇ½SQLÕâÑùͨ¹ýÕâ¸öÓû§Ãû¾ÍÄܲ鿴µ½´ËÓû§ÃûµÇ½֮ºóÕ¼ÓõÄÁ¬½ÓÁË¡£
Èç¹û²»Ð´UserName£¬ÄÇô·µ»ØµÄ¾ÍÊÇËùÓеÄÁ¬½Ó¡£
Ïà¹ØÎĵµ£º
1.oracle»·¾³
create table test
(
id number(4),
name varchar2(20)
)
ÔÚÒ»¸ösessionÖÐ
insert into test values(1,'aa');
ÔÚÁíÒ»¸ösessionÖÐ
select * from test1;
²éѯû±»×èÈû
2.sqlserver»·¾³
ÔÚÒ»¸ösessionÖÐ
insert into test values(1,'aa');
ÔÚÁíÒ»¸ösessionÖÐ
select * from test1;
²éѯ±»×èÈû(Ê ......
1.°²×°ºÃSQLServer 2005Êý¾Ý¿âÈí¼þ£¬½Ó×Å×îÖØÒªµÄ¾ÍÊÇ°²×°Êý¾Ý¿âÇý¶¯SQL Server 2005 driver for JDBC£¬¿ÉÒÔµ½:http://download.microsoft.com/download/8/B/D/8BDABAE2-B6EA-41D4-B903-7916EF3690EF/sqljdbc_1.2.2323.101_enu.exeÏÂÔØ
2.½«JDBC½âѹµ½ÈÎÒâµÄλÖã¬ÔÚ°²×°Ä¿Â¼ÀïÕÒµ½sqljdbc.jarÎļþ£¬ÒÔÇ°µÄÎÄÕÂÖÐÒѾ½²¹ý» ......
΢ÈíµÄSQL SERVERÌṩÁËÁ½ÖÖË÷Òý£º¾Û¼¯Ë÷Òý(clustered index£¬Ò²³Æ¾ÛÀàË÷Òý¡¢´Ø¼¯Ë÷Òý)ºÍ·Ç¾Û¼¯Ë÷Òý(nonclustered index£¬Ò²³Æ·Ç¾ÛÀàË÷Òý¡¢·Ç´Ø¼¯Ë÷Òý)……
(Ò»)ÉîÈëdz³öÀí½âË÷Òý½á¹¹
ʵ¼ÊÉÏ£¬Äú¿ÉÒÔ°ÑË÷ÒýÀí½âΪһÖÖÌØÊâµÄĿ¼¡£Î¢ÈíµÄSQL SERVERÌṩÁËÁ½ÖÖË÷Òý£º¾Û¼¯Ë÷Òý(clustered index£¬Ò²³Æ¾ÛÀàË÷Òý¡¢´ ......
Ê×ÏȲå¾äÌâÍâ»°£º´´½¨Ò»¸ö×ÔÈ»Êý±íNums¡£ÕâÊÇ¡¶SQL Server 2005¼¼ÊõÄÚÄ»£ºT-SQL²éѯ¡·Ò»ÊéµÄ½¨Òé¡£
ÔÚSQL Server 2005ÖУ¬¿ÉÒÔ½èÓÃROW_NUMBERÅÅÃûº¯ÊýÇáËÉÉú³ÉÎÒÃÇËùÐèµÄ×ÔÈ»Êý±í£º
--×ÔÈ»Êý±í1-1M
CREATE TABLE Nums(n int NOT NULL PRIMARY KEY CLUSTERED)
WITH B1 AS(SELECT n=1 UNION ALL SELECT n=1), --2
B2 AS( ......