»ñÈ¡Êý¾Ý¿âÖеıí½á¹¹µÄsqlÓï¾ä
--»ñȡij¸öÊý¾Ý¿âÖеıí½á¹¹
SELECT
--±íÃû=case when a.colorder=1 then d.name else '' end,
ÐòºÅ=a.colorder,
--±êʶ=case when COLUMNPROPERTY( a.id,a.name,'IsIdentity')=1 then 'ÊÇ'else '' end,
Ö÷¼ü=case when exists(SELECT 1 from sysobjects where xtype='PK' and name in (
SELECT name from sysindexes WHERE indid in(
SELECT indid from sysindexkeys WHERE id = a.id AND colid=a.colid
))) then 'ÊÇ' else '' end,
×Ö¶ÎÃû=a.name,
ÀàÐÍ=b.name,
Õ¼ÓÃ×Ö½ÚÊý=a.length,
³¤¶È=COLUMNPROPERTY(a.id,a.name,'PRECISION'),
ÔÊÐí¿ÕÖµ=case when a.isnullable=1 then 'ÊÇ'else '·ñ' end,
ĬÈÏÖµ=isnull(e.text,''),
×Ö¶ÎÃèÊö=isnull(g.[value],'')
from syscolumns a
left join systypes b on a.xtype=b.xusertype
inner join sysobjects d on a.id=d.id and d.xtype='U' and d.name&
Ïà¹ØÎĵµ£º
SQL Server 2005Êý¾Ý¿â¾µÏñ¼ò½é
×Ô´ÓSQL Server 2000ÒÔÀ´£¬ÄãÒѾÄܹ»Í¨¹ýʹÓø´ÖÆÀ´´´½¨Ò»¸ö±¸ÓõķþÎñÆ÷¡¢´«ÊäÈÕÖ¾£¬ÒÔ¼°±¸·ÝºÍÖØд洢ÁË——µ«ÊÇÏÖÔÚ΢ÈíÓÖÒýÈëÁËÒ»¸öÄÚ½¨µÄ¹¤¾ß£¬Ëü¿ÉÒÔʵÏÖ×Ô¶¯µÄ´íÎó»Ö¸´¡£Êý¾Ý¿â¾µÏñÊÇSQL Server 2005µÄÒ»¸öÐÂÌØÐÔ£¬ËüÔÊÐíÄ㽫һ¸öSQL ServerÖеÄÊý¾Ý¿âÄÚÈݾµÏñµ½ÁíÒ»¸öS ......
µÚÒ»ÖÖÓ÷¨£º
SELECT (CASE type WHEN 'u' THEN 'Óû§±í' WHEN 's' THEN 'ϵͳ±í' ELSE 'ÆäËû' END) AS TABLEKIND,* from SYSOBJECTS
µÚ¶þÖÐÓ÷¨£º
SELECT (CASE WHEN crdate<'2006-01-01' THEN 'early' WHEN crdate<'2009-01-01' THEN 'nearly' ELSE 'now' END) AS PERIOD,* from SYSOBJECTS ......
²Î¿¼ÎÄÏ×£ºhttp://www.cnblogs.com/chenxizhang/archive/2009/04/23/1441913.html
SQL ServerÌṩËÄÖÖ·½Ê½Á¬½ÓÊý¾Ý¿â·þÎñÆ÷:
1. share memory: Ö»ÊÊÓÃÓÚ¿Í»§¶ËºÍ·þÎñÆ÷¶ËÔÚͬһ̨»úÆ÷ÉÏ,²ÅÄܲÉÓõÄÁ¬½Ó
2. Named pipe:
ÔÚ¾ÖÓòÍø(LAN)ÄÚʵÏÖÁ¬½Ó,Ò»¸ö½ø³ÌʹÓÃÒ»²¿·ÖµÄÄÚ´æÀ´Ïò½ø³ÌµÄÁíÒ»¶Ë´«µÝÏûÏ¢,Ò»¸ö½ø³ÌµÄÊä³öÊÇÁíÍâ ......
//--Ìí¼Ó·þÎñÆ÷
EXEC sp_addlinkedserver
@server='LQXLSJ-600A5A60',--±»·ÃÎʵķþÎñÆ÷±ðÃû
@srvproduct='',
@provider='SQLOLEDB',
@datasrc='LQXLSJ-600A5A60' --Òª·ÃÎ ......
order by
ÅÅÐòͨ¹ýorder by×Ó¾äʵÏÖ£¬order byÔÚSELECTÓï¾äµÄ×îºó¡£
Óï·¨£º
order by field1 [ASC|DESC][,field2 [ASC|DESC],..,fieldn [ASC|DESC]]
ASC£ºÉýÐò
DESC£º½µÐò
ĬÈÏΪÉýÐò
¿ÕÖµ×÷ΪÎÞÇî´óÀ´´¦Àí¡£
ÁíÍâ¿ÉÒÔ°´ÕÕ²éѯÁбíÖÐÐòºÅ½øÐÐÅÅÐò¡£
ϵͳÔÚÓû§Ð´³ö²éѯÁбíµÄͬʱ¾Í¸³Óèÿ¸öÁÐÃûÒ»¸ ......