SQLÓï¾ä£º²éѯÊý¾Ý¿âÖÐËùÓзÇϵͳ±íµÄÐÅÏ¢
SELECT
(case when a.colorder=1 then d.name else '' end)±íÃû,
a.colorder ×Ö¶ÎÐòºÅ,
a.name ×Ö¶ÎÃû,
(case when COLUMNPROPERTY( a.id,a.name,'IsIdentity')=1 then '√'else '' end) ±êʶ,
(case when (SELECT count(*)
from sysobjects
WHERE (name in
(SELECT name
from sysindexes
WHERE (id = a.id) AND (indid in
(SELECT indid
from sysindexkeys
WHERE (id = a.id) AND (colid in
(SELECT colid
from syscolumns
WH
Ïà¹ØÎĵµ£º
Óï¾ä£ºselect rank() over(Order By ±íµÄÖ÷¼ü Desc) As UID ,ÆäËûÁÐ from ±í
˵Ã÷£ºrankº¯Êý
×÷Óãº
·µ»ØÖ¸¶¨Ôª×éÔÚÖ¸¶¨¼¯ÖеÄÅÅÃû£¨ÅÅÃû´Ó 1 ¿ªÊ¼£©
Rank(Tuple_Expression, Set_Expression [ ,Numeric Expression ] )
²ÎÊý£º
Tuple_Expression
Ò»¸öÓÐЧµÄ¶àά±í´ïʽ (MDX) Ôª ......
declare @dfname varchar(50)
select @dfname=a.name
from sysobjects a
inner join syscomments b on a.id=b.id
inner join sysconstraints  ......
----²é¿´ËùÓнDZ¾
Create table #y (txt text)
select name, iid = identity(int,1,1) into #x from SysObjects where xtype = 'TR'
declare @i int, @max int
declare @name varchar(40)
set @i = 1
select @max = max(iid) from #x
while @i <= @max
begin
select @name = name from #x w ......
ÔÚ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*/
±íÃ÷¶ÔÓï¾ä¿ ......
ÎÒÃÇÒª×öµ½²»µ«»áдSQL,»¹Òª×öµ½Ð´³öÐÔÄÜÓÅÁ¼µÄSQL,ÒÔÏÂΪ±ÊÕßѧϰ¡¢ÕªÂ¼¡¢²¢»ã×ܲ¿·Ö×ÊÁÏÓë´ó¼Ò·ÖÏí£¡
£¨1£© Ñ¡Ôñ×îÓÐЧÂʵıíÃû˳Ðò(Ö»ÔÚ»ùÓÚ¹æÔòµÄÓÅ»¯Æ÷ÖÐÓÐЧ)£º
ORACLE µÄ½âÎöÆ÷°´ÕÕ´ÓÓÒµ½×óµÄ˳Ðò´¦Àífrom×Ó¾äÖеıíÃû£¬from×Ó¾äÖÐдÔÚ×îºóµÄ±í(»ù´¡±í driving table)½«±»×îÏÈ´¦Àí£¬ÔÚfrom× ......