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

·ÀÖ¹SQL SERVERµÄʼþ̽²éÆ÷¸ú×Ù³ÌÐòÖÐSQL½Å±¾

ÈçºÎ·ÀÖ¹³ÌÐòÖÐSQL½Å±¾±»SQL SERVERµÄʼþ̽²éÆ÷¸ú×Ù£¬±£ÕÏ×Ô¼ºµÄÈí¼þ²»±»ËûÈË·ÖÎö£¿
ÏÂÃæÊÇÒ»¸öÍ£Ö¹ËùÓÐSQLSERVERµÄ¸ú×ÙÆ÷µÄ½Å±¾(Á½ÖÖ·½·¨µÄÔ­ÀíÏàͬ)£º
µÚÒ»ÖÖ·½·¨£º
procedure SQLCloseAllTrack;
const
sql = 'declare @TID integer ' +
'declare Trac Cursor For ' +
'SELECT Distinct Traceid from :: fn_trace_getinfo(default) ' +
'open Trac ' +
'Fetch Next from Trac into @TID ' +
'while @@fetch_status=0 ' +
'begin ' +
' exec sp_trace_setstatus @TID,0 ' +
' exec sp_trace_setstatus @TID,2 ' +
' Fetch Next from Trac into @TID ' +
'end ' +
'Close Trac ' +
'deallocate Trac';
begin
//Í£Ö¹ËùÓÐSQLSERVERµÄ¸ú×ÙÆ÷,ÒÔ·ÀÖ¹³ÌÐò±»別È˸ú×Ù
ExecSql(sql);
end;
µÚ¶þÖÖ·½·¨£º
with faq1 do
begin
Close;
sql.Clear;
sql.add('declare @t_count int');
sql.add('set @t_count=1');
sql.add('while exists(SELECT * from ::::fn_trace_geteventinfo(@t_count))');
sql.add('begin');
sql.add('exec sp_trace_setstatus @t_count,0');
sql.add('set @t_count=@t_count+1');
sql.add('end');
try
execSQL;
except;
end;
close;sql.Clear;
end;
end;


Ïà¹ØÎĵµ£º

SQL Server 2008×èÖ¹±£´æÒªÇóÖØÐ´´½¨±íµÄ¸ü¸Ä


н¨Êý¾Ý±íÒÔºó£¬ÈôÔÙ¶Ô¸Ã±í½øÐиü¸Ä£¬Ôò»á³öÏÖ¾¯¸æÐÅÏ¢“²»ÔÊÐí±£´æ¸ü¸Ä ×èÖ¹±£´æÒªÇóÖØÐ´´½¨±íµÄ¸ü¸Ä”£¬µÈµÈ£¬ÐèÒª½øÐÐÒ»ÏÂÉèÖ㺹¤¾ß--->Ñ¡Ïî--->Designers--->±íÉè¼ÆÆ÷ºÍÊý¾Ý¿âÉè¼ÆÆ÷--->×éÖ¯±£´æÒªÇóÖØÐ´´½¨±íµÄ¸ü¸Ä£¬È¥µô¸´Ñ¡¿ò¡£
À´Ô´ÍøÂ磺“²»ÊǺÜÀí½âΪʲôÔÚ2008Öлá¼ÓÈë"×èÖ¹ ......

ÔÚ SQl SERVER 2005Öе÷Óõ±Ç°Óû§£É£Ä


ÎÊÌ⣺
ÎÒÏÖÔÚÄÚÈݶ¼µ÷ÓóöÀ´ÁË  ¾ÍÊÇΨһµÄÒ»¸öÎÊÌâ¡¡¡¡ÎÒÒªµ÷µ±Ç°Óû§ID¡¡ÎÒÓõÄPHPCMS {$r[userid]}Õâ¸ö±äÁ¿ ÔÚSqlServerÉϵ÷Óò»µ½ 
$sql="SELECT CustomerID, Carid, TotolPoints, TakePoints, LeavingPoints, CarType,Activation,Consumption 
fro ......

SQL Server·ÖÒ³3ÖÖ·½°¸

 SQL Server·ÖÒ³3ÖÖ·½°¸±ÈÆ´
´Ë×ªÔØÔ´×ÔÀîºé¸ùµÄblog.×÷ÕßÊÇ΢ÈíµÄMVP!Ï£Íû´ó¼Ò²Î¿¼ÒÔÏÂ3ÖÖ·½°¸,°´Êµ¼ÊÇé¿öÑ¡Ôñ!
½¨Á¢±í£º
CREATE TABLE [TestTable] (
 [ID] [int] IDENTITY (1, 1) NOT NULL ,
 [FirstName] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
 [LastName] [nvarchar] (100) ......

SQL¾­µä¶ÌС´úÂëÊÕ¼¯ 1

--
SQL Server£º
Select
 
TOP
 N 
*
 
from
 
TABLE
 
Order
 
By
 
NewID
() 
--
Access£º
Select
 
TOP
 N 
*
 
from
 
TABLE
 
Order
 
By
 Rnd(ID)  
Rnd(ID) ÆäÖеÄID ......

sqlÓï¾äÓÅ»¯30Àý×Ó

ÔÚSQLÓï¾äÓÅ»¯¹ý³ÌÖУ¬ÎÒÃǾ­³£»áÓõ½hint,ÏÖ×ܽáÒ»ÏÂÔÚSQLÓÅ»¯¹ý³ÌÖг£¼ûOracle HINTµÄÓ÷¨£º
1. /*+ALL_ROWS*/
±íÃ÷¶ÔÓï¾ä¿éÑ¡Ôñ»ùÓÚ¿ªÏúµÄÓÅ»¯·½·¨,²¢»ñµÃ×î¼ÑÍÌÍÂÁ¿,ʹ×ÊÔ´ÏûºÄ×îС»¯.
ÀýÈç:
SELECT /*+ALL+_ROWS*/ EMP_NO,EMP_NAM,DAT_IN from BSEMPMS WHERE EMP_NO='SCOTT';
2. /*+FIRST_ROWS*/
±íÃ÷¶ÔÓï¾ä¿éÑ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ