Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB
ÈÈÃűêÇ©£º c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 ×îÐÂÎÄÕ : sqlserver

SqlServerÃüÃû¹æ·¶

SqlServerÃüÃû¹æ·¶
²Î¿¼¸÷ÖÖÃüÃû¹æ·¶£¬ÎÒÃÇͳһʹÓÃÃüÃû¹æ·¶ÈçÏ£º
ÃüÃû¹ý³ÌÖÐÈçÓÐÏÖ´æµÄËõд£¬ÔòʹÓøÃËõд£¬ÈçÎÞ£¬Ò»Âɲ»µÃËõд£¬Àý£ºISBN
Êý¾Ý¿â£ºÓÃÒ»¸ö»òÈý¸öÒÔÏÂÓ¢Îĵ¥´Ê×é³É£¬µ¥´ÊÊ××Öĸ´óд£¬È磺DepartmentManage£»
±íÃû£ºÊ¹ÓÃÃû´ÊÐÔÖʵĵ¥´ÊÈ«Æ´±íʾ£¬¸÷µ¥´ÊÊ××Öĸ´óд£¬ ʹÓø´ÊýÐÎʽ£¬È磺Books
      Èç¹û¸Ã±íÓÃÓÚ±íÃ÷ÁíÍâÁ½±íÖÐ×ֶμäµÄ¹Øϵ£¬Óõ¥Êý(¼´±íÃ÷ʵÌå¼äµÄ¹ØϵµÄ±íÓõ¥ÊýÃüÃû),µ¥´ÊÖмäÎÞ“and of in”Ö®ÀàµÄ½é´Ê
      È磺BookAuthor
==============================================================================================
 
1. ±íÖеÄ×Ö¶ÎÒ»°ãʹÓÃÃû´ÊÐÔÖʵĵ¥´ÊÈ«Æ´±íʾ£¬²ÉÓÃÒ»¸ö»òÈý¸öÒÔÏÂÓ¢Îĵ¥´Ê×é³É£¬µ¥´ÊÊ××Öĸ´óд£¬È磺UserName;
2. ±íÖ÷¼üÃû³ÆΪ£º±íÃû+ID£¬ÈçDocument±íµÄÖ÷¼üÃûΪ£ºDocumentID
3. Íâ¼üÃû³Æλ£ºÖ÷±íÃû+¶ÔÓ¦ÁÐÃû£¬È磺DepartmentsID£¬ËµÃ÷ÈçÏ£º
    ÔÚ±íDepartmentsÖУ¬Æä×Ö¶ÎÓУºID, DepartmentName
    ÔÚ±íUserInfoÖУ¬Æä×Ö¶ÎÓУºUserId,UserName,DepartmentsID    Depa ......

SQLServerÊý¾Ý¿âÉè¼Æ±íºÍ×Ö¶Î(ת)

SQL ServerÊý¾Ý¿âÉè¼Æ±íºÍ×Ö¶Î
2009/02/18 12:29
1. ԭʼµ¥¾ÝÓëʵÌåÖ®¼äµÄ¹Øϵ
¡¡¡¡¿ÉÒÔÊÇÒ»¶ÔÒ»¡¢Ò»¶Ô¶à¡¢¶à¶Ô¶àµÄ¹Øϵ¡£ÔÚÒ»°ãÇé¿öÏ£¬ËüÃÇÊÇÒ»¶ÔÒ»µÄ¹Øϵ£º¼´Ò»ÕÅԭʼµ¥¾Ý¶ÔÓ¦ÇÒÖ»¶ÔÓ¦Ò»¸öʵÌå¡£ÔÚÌØÊâÇé¿öÏ£¬ËüÃÇ¿ÉÄÜÊÇÒ»¶Ô¶à»ò¶à¶ÔÒ»µÄ¹Øϵ£¬¼´Ò»ÕÅԭʼµ¥Ö¤¶ÔÓ¦¶à¸öʵÌ壬»ò¶àÕÅԭʼµ¥Ö¤¶ÔÓ¦Ò»¸öʵÌå¡£ÕâÀïµÄʵÌå¿ÉÒÔÀí½âΪ»ù±¾±í¡£Ã÷È·ÕâÖÖ¶ÔÓ¦¹Øϵºó£¬¶ÔÎÒÃÇÉè¼Æ¼Èë½çÃæ´óÓкô¦¡£
¡¡¡¡¡¼Àý1¡½£ºÒ»·ÝÔ±¹¤ÂÄÀú×ÊÁÏ£¬ÔÚÈËÁ¦×ÊÔ´ÐÅϢϵͳÖУ¬¾Í¶ÔÓ¦Èý¸ö»ù±¾±í£ºÔ±¹¤»ù±¾Çé¿ö±í¡¢Éç»á¹Øϵ±í¡¢¹¤×÷¼òÀú±í¡£Õâ¾ÍÊÇ“Ò»ÕÅԭʼµ¥Ö¤¶ÔÓ¦¶à¸öʵÌ唵ĵäÐÍÀý×Ó¡£
¡¡¡¡ 2. Ö÷¼üÓëÍâ¼ü
¡¡¡¡Ò»°ã¶øÑÔ£¬Ò»¸öʵÌå²»ÄܼÈÎÞÖ÷¼üÓÖÎÞÍâ¼ü¡£ÔÚE—R ͼÖÐ, ´¦ÓÚÒ¶×Ó²¿Î»µÄʵÌå, ¿ÉÒÔ¶¨ÒåÖ÷¼ü£¬Ò²¿ÉÒÔ²»¶¨ÒåÖ÷¼ü(ÒòΪËüÎÞ×ÓËï), µ«±ØÐëÒªÓÐÍâ¼ü(ÒòΪËüÓи¸Ç×)¡£
¡¡¡¡Ö÷¼üÓëÍâ¼üµÄÉè¼Æ£¬ÔÚÈ«¾ÖÊý¾Ý¿âµÄÉè¼ÆÖУ¬Õ¼ÓÐÖØÒªµØλ¡£µ±È«¾ÖÊý¾Ý¿âµÄÉè¼ÆÍê³ÉÒÔºó£¬ÓиöÃÀ¹úÊý¾Ý¿âÉè¼Æר¼Ò˵£º“¼ü£¬µ½´¦¶¼ÊǼü£¬³ýÁ˼üÖ®Í⣬ʲôҲûÓД£¬Õâ¾ÍÊÇËûµÄÊý¾Ý¿âÉè¼Æ¾­Ñé̸֮£¬Ò²·´Ó³ÁËËû¶ÔÐÅϢϵͳºËÐÄ(Êý¾ÝÄ£ÐÍ)µÄ¸ß¶È³éÏó˼Ïë¡£ÒòΪ£ºÖ÷¼üÊÇʵÌåµÄ¸ß¶È³éÏó£¬Ö÷¼üÓëÍâ¼ ......

VCµ÷Óô洢¹ý³ÌµÄͨÓ÷½·¨£¨SQLServerƪ£©

ÕâÀïÌÖÂÛµÄÊÇADOµ÷Óô洢¹ý³Ì£¬°´MSDNµÄÀý×Ó£¬Ò»°ã¶¼ÊÇÏÂÃæµÄµ÷Ó÷½·¨£¨½ÚÑ¡×ÔMSDN£©£º
HRESULT hr = S_OK;
    // Define ADO object pointers.
    // Initialize pointers on define.
    // These are in the ADODB::  namespace.
    _RecordsetPtr pRstByRoyalty = NULL;
    _RecordsetPtr pRstAuthors = NULL; 
    _CommandPtr   pcmdByRoyalty = NULL;
    _ParameterPtr pprmByRoyalty = NULL;
    _ConnectionPtr pConnection = NULL;
    _bstr_t strCnn("Provider=sqloledb;Data Source=srv;"
        "Initial Catalog=Pubs;User Id=sa;Password=;");
    _bstr_t strMessage, strAuthorID;
    int intRoyalty;
    VARIANT vtRoyalty;
    try
    {
        //Open a Connection.
     & ......

»ñÈ¡SQLServerµÄ×îÍêÕûÊý¾Ý×ÖµäµÄSQLÓï¾ä

Ô­´´ÓÚ2008Äê06ÔÂ18ÈÕ£¬2009Äê10ÔÂ18ÈÕǨÒÆÖÁ´Ë¡£
»ñÈ¡SQLServer
µÄ×îÍêÕûÊý¾Ý×ÖµäµÄSQL
Óï¾ä
 
ÆäʵÍøÉÏÒѾ­Á÷´«Á˺ܶà¹ØÓÚ»ñÈ¡
SQLServer
µÄÊý¾Ý×ÖµäµÄ°æ±¾£¬²»¹ýÎÒÏàÐÅÕâ¸öÓ¦¸ÃÊÇ×îÈ«µÄÁË£¬±¾Óï¾ä°üÀ¨ÁË±í¡¢×ֶΡ¢×Ö¶ÎÀàÐÍ¡¢×ֶγ¤¶È¡¢ÊÇ·ñΪ¿Õ¡¢ÊÇ·ñµÝÔö×ֶΡ¢Ë÷ÒýÃû³Æ¡¢Ë÷ÒýµÄ¶¨Î»¡¢Ë÷ÒýÀàÐÍ¡¢Ö÷¼ü¡¢Íâ¼üµÈ£»Í¨¹ýºÏÀíµÄ²Ã¼ô¿ÉÒԺܷ½±ãµÄÉú³ÉÏàÓ¦µÄÊý¾Ý×ֵ䡣
 
SELECT
sysobjects.name AS
±íÃû³Æ
,ITPUB¸öÈË¿Õ¼äqpd6Bv c~~ \0s%?7k(@
--sysproperties.[value] AS
±í˵Ã÷
,
Zqm6iAu:{6517
syscolumns.name AS
×Ö¶ÎÃû³Æ
,ITPUB¸öÈË¿Õ¼ä'y:q,dLc,d2b
--properties.[value] AS
×Ö¶Î˵Ã÷
,
ShKAM_p6517
systypes.name AS
×Ö¶ÎÀàÐÍ
,
:x-q
z$[X'n6517
syscolumns.length AS
×ֶ㤶È
,ITPUB¸öÈË¿Õ¼ä3g.O
h/o}t"t:[
ISNULL(COLUMNPROPERTY(syscolumns.id,
syscolumns.name,'Scale'), 0) AS
СÊýλÊý
,
CASE WHEN syscolumns.isnullable=0
bhvB-?6517
 THEN ''ITPUB¸öÈË¿Õ¼äut"t.a;w;uO*g
ELSE '

'ITPUB¸öÈË¿Õ¼ä)u(DZ)}�RM%M
END AS
ÊÇ·ñΪ¿Õ
,
0JH2 ......

»ñÈ¡SQLServerµÄ×îÍêÕûÊý¾Ý×ÖµäµÄSQLÓï¾ä

Ô­´´ÓÚ2008Äê06ÔÂ18ÈÕ£¬2009Äê10ÔÂ18ÈÕǨÒÆÖÁ´Ë¡£
»ñÈ¡SQLServer
µÄ×îÍêÕûÊý¾Ý×ÖµäµÄSQL
Óï¾ä
 
ÆäʵÍøÉÏÒѾ­Á÷´«Á˺ܶà¹ØÓÚ»ñÈ¡
SQLServer
µÄÊý¾Ý×ÖµäµÄ°æ±¾£¬²»¹ýÎÒÏàÐÅÕâ¸öÓ¦¸ÃÊÇ×îÈ«µÄÁË£¬±¾Óï¾ä°üÀ¨ÁË±í¡¢×ֶΡ¢×Ö¶ÎÀàÐÍ¡¢×ֶγ¤¶È¡¢ÊÇ·ñΪ¿Õ¡¢ÊÇ·ñµÝÔö×ֶΡ¢Ë÷ÒýÃû³Æ¡¢Ë÷ÒýµÄ¶¨Î»¡¢Ë÷ÒýÀàÐÍ¡¢Ö÷¼ü¡¢Íâ¼üµÈ£»Í¨¹ýºÏÀíµÄ²Ã¼ô¿ÉÒԺܷ½±ãµÄÉú³ÉÏàÓ¦µÄÊý¾Ý×ֵ䡣
 
SELECT
sysobjects.name AS
±íÃû³Æ
,ITPUB¸öÈË¿Õ¼äqpd6Bv c~~ \0s%?7k(@
--sysproperties.[value] AS
±í˵Ã÷
,
Zqm6iAu:{6517
syscolumns.name AS
×Ö¶ÎÃû³Æ
,ITPUB¸öÈË¿Õ¼ä'y:q,dLc,d2b
--properties.[value] AS
×Ö¶Î˵Ã÷
,
ShKAM_p6517
systypes.name AS
×Ö¶ÎÀàÐÍ
,
:x-q
z$[X'n6517
syscolumns.length AS
×ֶ㤶È
,ITPUB¸öÈË¿Õ¼ä3g.O
h/o}t"t:[
ISNULL(COLUMNPROPERTY(syscolumns.id,
syscolumns.name,'Scale'), 0) AS
СÊýλÊý
,
CASE WHEN syscolumns.isnullable=0
bhvB-?6517
 THEN ''ITPUB¸öÈË¿Õ¼äut"t.a;w;uO*g
ELSE '

'ITPUB¸öÈË¿Õ¼ä)u(DZ)}�RM%M
END AS
ÊÇ·ñΪ¿Õ
,
0JH2 ......

ÔÝʱ½â¾öPHPÁ¬½ÓSQLserver2005ÂÒÂëÎÊÌâ.

Êý¾Ý¿âÊÇsqlserver2005,Êý¾Ý´æ´¢µÄ¾ßÌå±àÂë²»Ïê. µ½ÍøÉÏÕÒÁ˶ÎתÂ뺯Êý /*        ¶¨Òå×Ö·ûת»»º¯Êý£¬½â¾ömssqlÖÐÎÄÂÒÂëÎÊÌâ            */
function convert2utf8($string)
     {
        return iconv("gbk","utf-8",$string);
     }
function convert2gbk($string)
     {
        return iconv("utf-8","gbk",$string);
     }   ½â¾öÖÐÎÄÂÒÂëÎÊÌâ.µ«ÊDz»ÖªµÀsqlserver ÖÐÓÐûÓÐ ÀàËÆ mysqlÖÐµÄ set names utf8 ÕâÖÖÀàËƵÄÓï¾ä..ÕýÔÚѧϰÖÐ... ......

ÔÝʱ½â¾öPHPÁ¬½ÓSQLserver2005ÂÒÂëÎÊÌâ.

Êý¾Ý¿âÊÇsqlserver2005,Êý¾Ý´æ´¢µÄ¾ßÌå±àÂë²»Ïê. µ½ÍøÉÏÕÒÁ˶ÎתÂ뺯Êý /*        ¶¨Òå×Ö·ûת»»º¯Êý£¬½â¾ömssqlÖÐÎÄÂÒÂëÎÊÌâ            */
function convert2utf8($string)
     {
        return iconv("gbk","utf-8",$string);
     }
function convert2gbk($string)
     {
        return iconv("utf-8","gbk",$string);
     }   ½â¾öÖÐÎÄÂÒÂëÎÊÌâ.µ«ÊDz»ÖªµÀsqlserver ÖÐÓÐûÓÐ ÀàËÆ mysqlÖÐµÄ set names utf8 ÕâÖÖÀàËƵÄÓï¾ä..ÕýÔÚѧϰÖÐ... ......

¹ØÓÚSQLServerËÀËøµÄÕï¶ÏºÍ¶¨Î»

Ô­´´ÓÚ2008Äê06ÔÂ18ÈÕ£¬2009Äê10ÔÂ18ÈÕǨÒÆÖÁ´Ë¡£
¹ØÓÚ
SQLServer
ËÀËøµÄÕï¶ÏºÍ¶¨Î»
 
ÔÚ
SQLServer
Öо­³£»á·¢ÉúËÀËøÇé¿ö£¬±ØÐëÁ¬½Óµ½ÆóÒµ¹ÜÀí
Æ÷—
>
¹ÜÀí—
>
µ±Ç°»î¶¯—
>
Ëø
/
½ø³Ì
ID
È¥²éÕÒÏà¹ØËÀËø½ø³ÌºÍ¶¨Î»ËÀËøµÄÔ­Òò¡£
ITPUB¸öÈË¿Õ¼ä4eD!w!`JD
&h{X!tH{6517
ͨ¹ý²éѯ·ÖÎöÆ÷Ò²Òª¾­¹ý¶à¸öϵͳ±í
(sysprocesses,sysobjects
µÈ
)
ºÍϵͳ´æ´¢¹ý³Ì
(sp_who,sp_who2,sp_lock
µÈ
)
£¬¶øÇÒ²»Ò»¶¨Äܹ»Ö±½Ó¶¨Î»µ½¡£
±¾´æ´¢¹ý³Ì²Î¿¼
sp_lock_check
ºÍ
sysprocesses
ϵͳ±í£¬Í¬Ê±ÀûÓÃÁË
DBCC
ÃüÁֱ½Ó½«ËÀËøºÍÔì³ÉËÀËøµÄ½ø³ÌºÍÏà¹ØÓï¾äÁгö£¬ÒÔ·½±ã·ÖÎöºÍ¶¨Î»¡£
ITPUB¸öÈË¿Õ¼ä&g5yR
P5Bt~
ITPUB¸öÈË¿Õ¼äyv?wpH7B
 
Create procedure sp_check_deadlock            
as
set nocount on
 /*
selectITPUB¸öÈË¿Õ¼ä6lE|*`f4`\0jE
spid   
±»Ëø½ø³Ì
ID,
Mao^#Qz9w~6517
blocked
Ëø½ø³Ì
ID,
2W O+G;a2KSP6517
status 
±»Ëø״̬
,
!j0Qzbhx6517
SUBST ......
×ܼǼÊý:341; ×ÜÒ³Êý:57; ÿҳ6 Ìõ; Ê×Ò³ ÉÏÒ»Ò³ [46] [47] [48] [49] 50 [51] [52] [53] [54] [55]  ÏÂÒ»Ò³ βҳ
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ