»ñÈ¡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£¬ÄÇô·µ»ØµÄ¾ÍÊÇËùÓеÄÁ¬½Ó¡£
Ïà¹ØÎĵµ£º
È«ÎļìË÷ÊǶԴóÊý¾ÝÎı¾½øÐÐË÷Òý£¬ÔÚ½¨Á¢µÄË÷ÒýÖжÔÒª²éÕҵĵ¥´Ê½øÐнøÐÐËÑË÷£¬¶¨Î»ÄÄЩÎı¾Êý¾Ý°üÀ¨ÒªËÑË÷µÄµ¥´Ê¡£Òò´Ë£¬È«ÎļìË÷µÄÈ«²¿¹¤×÷¾ÍÊǽ¨Á¢Ë÷ÒýºÍÔÚË÷ÒýÖÐËÑË÷¶¨Î»£¬ËùÓеŤ×÷¶¼ÊÇÎ§ÈÆÕâÁ½¸öÀ´½øÐеġ£ÏÂÃæ¾ÍÖð¸ö½éÉÜ¡£
¡¡¡¡½¨Á¢È«ÎÄË÷ÒýÖÐÓÐÁ½Ïî·Ç³£ÖØÒª£¬Ò»¸öÊÇÈçºÎ¶ÔÎı¾½øÐзִʣ¬Ò»Êǽ¨Á¢Ë÷ÒýµÄÊý¾Ý½á¹¹¡ ......
Oracle´æ´¢¹ý³Ìת³ÉSqlserver´æ´¢¹ý³Ì
1.ÈÕÆÚת»»
Oracle£º TO_NUMBER(TO_CHAR(SYSDATE, 'YYYYMMDD'))
SqlServer£ºCAST(CONVERT(CHAR(8),GETDATE(), 112) AS INT)
×¢£ºÆäÖБYYYYMMDD’¸ñʽ ¶ÔÓ¦112
2.ROWIDת»»
Oracle£º ROWID
SqlServer: PRIMARY KEY(±íÖ÷¼ü)
3.ROWNUM ......
sqlserverÊý¾Ý¿â£ºjavaÁ¬½Ósqlserver2005Êý¾Ý¿âÐĵÃÌå»á
Ê×ÏȵÃÏÂÔØÇý¶¯³ÌÐòµ½Î¢ÈíÍøÕ¾ÏÂÔØMicrosoft SQL Server 2005 JDBC Driver 1.2¡¡¡¡½âѹMicrosoft SQL Server 2005 jdbc driver1.2.exe
µÃµ½sqljdbc.jar£¬ÓõÃʱºòÖ±½Ó¼Óµ½classpathÖÐÈ¥.
¡¡ÉèÖÃSQL Server·þÎñÆ÷
·ÀÖ¹³öÏÖ
com.mi ......
ÎÞÂÛÊÇÔÚsql 2000£¬»¹ÊÇÔÚ sql 2005 ÖÐ,¶¼Ã»ÓÐÌṩ×Ö·û´®µÄ¾ÛºÏº¯Êý£¬ËùÒÔ£¬µ±ÎÒÃÇÔÚ´¦ÀíÏÂÁÐÒªÇóʱ£¬»á±È½ÏÂé·³£ºÓбítb, ÈçÏ£ºid value----- ------1 aa1 bb2 aaa2 bbb2 cccÐèÒªµÃµ½½á¹û£ºid values------ -----------1 aa,bb2 aaa,bbb,ccc¼´£¬ group by id, Çó value µÄºÍ£¨×Ö·û´®Ïà¼Ó£©
1. ¾ÉµÄ½â¾ö·½·¨-- 1. ´´½¨´¦À ......