Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

dz̸»ùÓÚSQL Server ·ÖÒ³´æ´¢¹ý³ÌµÄÑݽø

 ¼òµ¥Ì¸»ùÓÚSQL SERVER ·ÖÒ³´æ´¢¹ý³ÌµÄÑݽø
×÷ÕߣºÖ£×ô
ÈÕÆÚ£º2006-9-30
Õë¶ÔÊý¾Ý¿âÊý¾ÝÔÚUI½çÃæÉϵķÖÒ³ÊÇÀÏÉú³£Ì¸µÄÎÊÌâÁË£¬ÍøÉϺÜÈÝÒ×ÕÒµ½¸÷Ö֓ͨÓô洢¹ý³Ì”´úÂ룬¶øÇÒÓÐЩ»¹¶¨ÖƲéѯÌõ¼þ£¬¿´ÉÏȥʹÓúܷ½±ã¡£±ÊÕß´òËãͨ¹ý±¾ÎÄÒ²À´¼òµ¥Ì¸Ò»Ï»ùÓÚSQL SERVER 2000µÄ·ÖÒ³´æ´¢¹ý³Ì£¬Í¬Ê±Ì¸Ì¸SQL SERVER 2005Ï·ÖÒ³´æ´¢¹ý³ÌµÄÑݽø¡£
ÔÚ½øÐлùÓÚUIÏÔʾµÄÊý¾Ý·Öҳʱ£¬³£¼ûµÄÊý¾ÝÌáÈ¡·½Ê½Ö÷ÒªÓÐÁ½ÖÖ¡£µÚÒ»ÖÖÊÇ´ÓÊý¾Ý¿âÌáÈ¡ËùÓÐÊý¾ÝÈ»ºóÔÚϵͳӦÓóÌÐò²ã½øÐÐÊý¾Ý·ÖÒ³£¬ÏÔʾµ±Ç°Ò³Êý¾Ý¡£µÚ¶þÖÖ·ÖÒ³·½Ê½Îª´ÓÊý¾Ý¿âÈ¡³öÐèÒªÏÔʾµÄÒ»Ò³Êý¾ÝÏÔʾÔÚUI½çÃæÉÏ¡£
ÒÔÏÂÊDZÊÕ߶ÔÁ½ÖÖʵÏÖ·½Ê½Ëù×öµÄÓÅȱµã±È½Ï£¬Õë¶ÔÓ¦ÓóÌÐò±àд£¬±ÊÕßÒÔ.NET¼¼Êõƽ̨ΪÀý¡£
Àà±ð
 SQLÓï¾ä
 ´úÂë±àд
 Éè¼Æʱ
 ÐÔÄÜ
 
µÚÒ»ÖÖ
 Óï¾ä¼òµ¥£¬¼æÈÝÐÔºÃ
 ºÜÉÙ
 ÍêÈ«Ö§³Ö
 Êý¾ÝÔ½´óÐÔÄÜÔ½²î
 
µÚ¶þÖÖ
 ¿´¾ßÌåÇé¿ö
 ½Ï¶à
 ²¿·ÖÖ§³Ö
 Á¼ºÃ£¬¸úSQLÓï¾äÓйØ
 
 
¶ÔÓÚµÚÒ»ÖÖÇé¿ö±¾ÎIJ»´òËã¾ÙÀý£¬µÚ¶þÖÖʵÏÖ·½Ê½±ÊÕßÖ»ÒÔÁ½´ÎTOP·½Ê½À´½øÐÐÌÖÂÛ¡£
ÔÚ±àд¾ßÌåSQLÓï¾ä֮ǰ£¬¶¨ÒåÒÔÏÂÊý¾Ý±í¡£
Êý¾Ý±íÃû³ÆΪ£ºProduction.Product¡£ProductionΪSQL SERVER 2005ÖиĽøºóµÄÊý¾Ý±í¼Ü¹¹£¬¶Ô¾ÙÀý²»Ôì³ÉÓ°Ïì¡£
°üº¬µÄ×Ö¶ÎΪ£º
ÁÐÃû
 Êý¾ÝÀàÐÍ
 ÔÊÐí¿Õ
 ËµÃ÷
 
ProductID
 Int
 
 ²úÆ·ID£¬PK¡£
 
Name
 Nvarchar(50)
 
 ²úÆ·Ãû³Æ¡£
 
²»ÄÑ·¢ÏÖÒÔÉϱí½á¹¹À´×ÔSQL SERVER 2005 ÑùÀýÊý¾Ý¿âAdventureWorksµÄProduction.Product±í£¬²¢ÇÒֻȡÆäÖÐÁ½¸ö×ֶΡ£ 
·ÖÒ³Ïà¹ØÔªËØ£º
PageIndex – Ò³ÃæË÷Òý¼ÆÊý£¬¼ÆÊý0ΪµÚÒ»Ò³¡£
PageSize – ÿ¸öÒ³ÃæÏÔʾ´óС¡£
RecordCount – ×ܼǼÊý¡£
PageCount – Ò³Êý¡£
¶ÔÓÚºóÁ½¸ö²ÎÊý£¬±ÊÕßÔÚ´æ´¢¹ý³ÌÖÐÒÔÊä³ö²ÎÊýÌṩ¡£
 
1£®SQL SERVER 2000ÖеÄTOP·ÖÒ³
CREATE PROCEDURE [Zhzuo_GetItemsPage]
    @PageIndex INT, /*@PageIndex´Ó¼ÆÊý,0ΪµÚÒ»Ò³*/
    @PageSize  INT, /*Ò³Ãæ´óС*/
    @RecordCount INT OUT, /*×ܼǼÊý*/
    @PageCount INT OUT /*Ò³Êý*/
AS
/*»ñÈ¡¼Ç¼Êý*/
SELECT @RecordCount = COUNT(*) from Production.Product


Ïà¹ØÎĵµ£º

Ô¶³Ì±¸·ÝsqlÊý¾Ý¿âµ½±¾»ú

 Ìõ¼þ£º
    ÓµÓÐsaȨÏÞ
    ¿ªÆô xp_cmdshell
·½·¨£º
 ¿ªÆô/¹Ø±Õ xp_cmdshell ±ØÐëÔÚ master  ¿âÖ´ÐÐ
EXEC sp_configure 'show advanced options', 1 
RECONFIGURE WITH OVERRIDE 
EXEC sp_configure 'xp_cmdshell', 1 
RECONFIGURE ......

ÈçºÎ²é¿´SQL Server ²¹¶¡µÄ°æ±¾£¿

 Õâ¸öÌâÄ¿ÌýÆðÀ´Ê®·ÖÞÖ¿Ú£¬Ó¢ÎÄÓ¦¸ÃÕâÑùд“How to find the service pack version installed on SQL Server using”£¬Õâ¸öÎÊÌâÎÒÒ»Ö±ÔÚÕÒ£¬SQL ServerһֱûÓÐÏñÆäËûÈí¼þÒ»Ñù¿ÉÒÔÖ±½Ó²é¿´µ½°æ±¾+²¹¶¡ºÅµÄ·½·¨£¬½ñÌìµ½Ò»¸öÀÏÍâµÄÍøÕ¾ÖÕÓÚÕÒµ½ÁË£º
ÓÐÁ½ÖÖ·½·¨£º
µÚÒ»²½£ºÊ¹ÓÃSQLÓï¾ä²éѯ
select @@version ......

SQL Server2005ËĸöÅÅÐòº¯Êý¼ò½é

ÅÅÃûº¯ÊýÊÇSQL Server2005мӵŦÄÜ¡£ÔÚSQL Server2005ÖÐÓÐÈçÏÂËĸöÅÅÃûº¯Êý£º
1. row_number ×Ô¶¯Éú³ÉÐкÅ,ÐòºÅÓÉorder by ×ֶξö¶¨
2. rank over Filed, ÓÉrank overµÄ×ֶξö¶¨£¬Ãû´Î²»Á¬Ðø£¬ÈçÓÐ3¸ö²¢ÁеÚÒ»Ãû£¬ÔòºóÐøÃû´ÎÖ±½Ó´Ó4¿ªÊ¼
3. dense_rank£¬ºÍrankÏàËÆ£¬Ö»ÊÇÃû´ÎÁ¬Ðø£¬ÈçÓÐ3¸ö²¢ÁеÚÒ»Ãû£ ......

Ôõô²¶»ñ×Ô¼ºsessionÖ´ÐеÄsql£¬½øÐÐÉîÈë¸ú×Ù

 
alter session set timed_statistics = true; --¿ÉÑ¡
alter session set max_dump_file_size = unlimited; --¿ÉÑ¡£¬·ÀÖ¹dumpĿ¼·Å²»ÏÂ
-- To enable the trace event 10046
alter session set events '10046 trace name context forever, level 8';
--ÉèÖÃTRACEFILE_IDENTIFIER²ÎÊýÖµ£¬ÈÃtraceÎļþ°üÀ¨MyTrac ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ