ÔÚSQL ServerÀï²é¿´µ±Ç°Á¬½ÓµÄÔÚÏßÓû§Êý
ÔÚSQL ServerÀï²é¿´µ±Ç°Á¬½ÓµÄÔÚÏßÓû§Êý
use master
select loginame,count(0) from sysprocesses
group by loginame
order by count(0) desc
select nt_username,count(0) from sysprocesses
group by nt_username
order by count(0) desc
Èç¹ûij¸öSQL ServerÓû§ÃûtestÁ¬½Ó±È½Ï¶à,²é¿´ËüÀ´×ÔµÄÖ÷»úÃû:
select hostname,count(0) from sysprocesses where loginame='test'
group by hostname
order by count(0) desc
Èç¹ûij¸öSQL ServerÓû§ÃûtestÁ¬½Ó±È½Ï¶à,²é¿´Ëü×îºóÒ»´Î²Ù×÷µÄʱ¼ä·¶Î§·Ö×é:
select convert(varchar,last_batch,111),count(0) from sysprocesses where loginame='test'
group by convert(varchar,last_batch,111)
order by count(0) desc
Èç¹û´ÓÖ÷»ú(www)À´µÄÁ¬½Ó±È½Ï¶à,¿ÉÒԲ鿴ËüµÄ½ø³ÌÏêϸÇé¿ö
select * from??sysprocesses where hostname='www'
Èç¹ûwww»úÆ÷Ö÷ÒªÌṩÍøÒ³·þÎñ,¿ÉÄÜÊÇasp³ÌÐò´¦ÀíÁ¬½Óʱ³öÁËÎÊÌâ, Éú³ÉɱÕâЩ½ø³ÌµÄSQLÓï¾ä:
select 'kill '+convert(varchar,spid) from sysprocesses where hostname='www'
Èç¹ûÕâÑùµÄÎÊÌâƵ·±³öÏÖ,¿ÉÒÔдһ¸ö´æ´¢¹ý³Ìsp_KillIdleSpids.sql,
дһ¸ö×÷Òµ, Ö´ÐÐËü, À´×Ô¶¯É±µô´ÓÖ÷»ú(www)À´µ«ÒѾһÌìûÓÐÏìÓ¦µÄÓû§Á¬½Ó.
?
?
?
--------------------------------
SQL ServerµÄÓû§¼°È¨ÏÞ?
?sysadmin ¿ÉÒÔÔÚ SQL Server ÖÐÖ´ÐÐÈκλ?
serveradmin ¿ÉÒÔÉèÖ÷þÎñÆ÷·¶Î§µÄÅäÖÃÑ¡Ïî ¹Ø±Õ·þÎñÆ÷?
setupadmin ¿ÉÒÔ¹ÜÀíÁ´½Ó·þÎñÆ÷ºÍÆô¶¯¹ý³Ì?
securityadmin ¿ÉÒÔ¹ÜÀíµÇ¼ºÍ CREATE DATABASE ȨÏÞ »¹¿ÉÒÔ¶ÁÈ¡´íÎóÈÕÖ¾ºÍ¸ü¸ÄÃÜÂë?
processadmin ¿ÉÒÔ¹ÜÀíÔÚ SQL Server ÖÐÔËÐеĽø³Ì?
dbcreator ¿ÉÒÔ´´½¨ ¸ü¸ÄºÍ³ýÈ¥Êý¾Ý¿â?
diskadmin ¿ÉÒÔ¹ÜÀí´ÅÅÌÎļþ?
bulkadmin ¿ÉÒÔÖ´ÐÐ BULK INSERT Óï¾ä?
Ïà¹ØÎĵµ£º
SQLÓï¾äÏÈǰдµÄʱºò£¬ºÜÈÝÒ×°ÑһЩÌØÊâµÄÓ÷¨Íü¼Ç£¬ÎÒÌØ´ËÕûÀíÁËÒ»ÏÂSQLÓï¾ä²Ù×÷£¬·½±ã×Ô¼ºÐ´SQLʱ·½±ãÒ»µã£¬ÏëÌùÉÏÀ´£¬Ò»Æð¿´¿´£¬Í¬Ê±Ï£Íû´ó¼ÒÄܹ²Í¬¶à¶àÌáÒâ¼û£¬Ò²¸øÎÒÁôһЩ¸üºÃµÄ¼Ñ¾ä£¬ÕûÀíÒ»·Ý¡¶¾«ÃîSQLËÙ²éÊֲᡷ£¬²»Áߴͽ̣¡
Ò»¡¢»ù´¡
1¡¢ËµÃ÷£º´´½¨Êý¾Ý¿â
CREATE DATABASE database-name
2¡¢ËµÃ÷£ºÉ¾³ýÊý¾ ......
×ܽáÒ»ÏÂSQLÓï¾äÖÐÒýºÅ(')¡¢quotedstr()¡¢('')¡¢format()ÔÚSQLÓï¾äÖеÄÓ÷¨ÒÔ¼°SQLÓï¾äÖÐÈÕÆÚ¸ñʽµÄ±íʾ(#)¡¢('')
ÔÚDelphiÖнøÐÐ×Ö·û±äÁ¿Á¬½ÓÏà¼Óʱµ¥ÒýºÅÓÃ('''),ÓÖÒýºÅÓÃ('''')±íʾ
Ê×Ïȶ¨Òå±äÁ¿
var
AnInt:integer=123;//ΪÁË·½±ãÔڴ˶¼¸øËüÃǸ³³õÖµ¡£ËäÈ»¿ÉÄÜÔÚÒý¸³³õÖµÔÚijЩÇé¿öϲ»¶Ô
AnIntStr:string='456'; ......
ORACLE SQLÓï¾äÓÅ»¯×ܽá
1£© Ñ¡Ôñ×îÓÐЧÂʵıíÃû˳Ðò(Ö»ÔÚ»ùÓÚ¹æÔòµÄÓÅ»¯Æ÷ÖÐÓÐЧ)£º
ORACLEµÄ½âÎöÆ÷°´ÕÕ´ÓÓÒµ½×óµÄ˳Ðò´¦Àífrom×Ó¾äÖеıíÃû£¬from×Ó¾äÖÐдÔÚ×îºóµÄ±í(»ù´¡±í driving table)½«±»×îÏÈ´¦Àí£¬ÔÚfrom×Ó¾äÖаüº¬¶à¸ö±íµÄÇé¿öÏÂ,Äã±ØÐëÑ¡Ôñ¼Ç¼ÌõÊý×îÉٵıí×÷Ϊ»ù´¡±í¡£Èç¹ûÓÐ3¸öÒÔÉϵıíÁ¬½Ó²éѯ, Ä ......
Êý¾Ý¿âÖÐÖ÷¼üºÍÍâ¼ü
(1)×÷ÓÃ
¼òµ¥ÃèÊö£º
Ö÷¼üÊǶԱíµÄÔ¼Êø£¬±£Ö¤Êý¾ÝµÄΨһÐÔ£¡
Íâ¼üÊǽ¨Á¢±íÓÚ±íÖ®¼äµÄÁªÏµ£¬·½±ã³ÌÐòµÄ±àд£¡
(2)Éè¼ÆÔÔò
Ö÷¼üºÍÍâ¼üÊǰѶà¸ö±í×é֯Ϊһ¸öÓÐЧµÄ¹ØϵÊý¾Ý¿âµÄÕ³ºÏ¼Á¡£Ö÷¼üºÍÍâ¼üµÄÉè¼Æ¶ÔÎïÀíÊý¾Ý¿âµÄÐÔÄܺͿÉÓÃÐÔ¶¼ÓÐמö¶¨ÐÔµÄÓ°Ïì¡£
±ØÐ뽫Êý¾Ý¿âÄ£Ê ......
winform주
//´æ´¢
private void MemoryImage()
{
string sql = "";
&nbs ......