£¨×ª£©ÀûÓà Sql Öв鿴±í½á¹¹ÐÅÏ¢
ת×Ô£ºhttp://hi.baidu.com/cszoo/blog/item/2439a5f517c19c2dbc31093c.html
£¨1£©
SELECT
±íÃû=case when a.colorder=1 then d.name else '' end,
±í˵Ã÷=case when a.colorder=1 then isnull(f.value,'') else '' end,
×Ö¶ÎÐòºÅ=a.colorder,
×Ö¶ÎÃû=a.name,
±êʶ=case when COLUMNPROPERTY( a.id,a.name,'IsIdentity')=1 then '√'else '' end,
Ö÷¼ü=case when exists(SELECT 1 from sysobjects where xtype='PK' and parent_obj=a.id 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,
ÀàÐÍ=b.name,
Õ¼ÓÃ×Ö½ÚÊý=a.length,
³¤¶È=COLUMNPROPERTY(a.id,a.name,'PRECISION'),
СÊýλÊý=isnull(COLUMNPROPERTY(a.id,a.name,'Scale'),0),
ÔÊÐí¿Õ=case when a.isnullable=1 then '√'else '' end,
ĬÈÏÖµ=isnull(e.text,''),
×Ö¶Î˵Ã÷=isnull(g.[value],'')
from syscolumns a
left join systypes b on a.xusertype=b.xusertype
inner join sysobjects d on a.id=d.id and d.xtype='U' and d.name<>'dtproperties'
left join syscomments e on a.cdefault=e.id
left join sysproperties g on a.id=g.id and a.colid=g.smallid
left join sysproperties f on d.id=f.id and f.smallid=0
--where d.name='Òª²éѯµÄ±í' --Èç¹ûÖ»²éѯָ¶¨±í,¼ÓÉÏ´ËÌõ¼þ
order by a.id,a.colorder
£¨2£©
SQL2000ϵͳ±íµÄÓ¦ÓÃ
--1£º»ñÈ¡µ±Ç°Êý¾Ý¿âÖеÄËùÓÐÓû§±í
select Name from sysobjects where xtype='u' and status>=0
--2£º»ñȡijһ¸ö±íµÄËùÓÐ×Ö¶Î
select name from syscolumns where id=object_id('±íÃû')
--3£º²é¿´Óëijһ¸ö±íÏà¹ØµÄÊÓͼ¡¢´æ´¢¹ý³Ì¡¢º¯Êý
select a.* from sysobjects a, syscomments b where a.id = b.id and b.text like '%±íÃû%'
--4£º²é¿´µ±Ç°Êý¾Ý¿âÖÐËùÓд洢¹ý³Ì
select name as ´æ´¢¹ý³ÌÃû³Æ from sysobjects where xtype='P'
--5£º²éѯÓû§´´½¨µÄËùÓÐÊý¾Ý¿â
select * from master..sysdatabases D where sid not in(select sid from master..syslogins where name='sa')
»òÕß
select dbid, name AS DB_NAME from master..sysdatabases where sid <> 0x01
--6£º²éѯijһ¸ö±íµÄ×ֶκÍÊý¾ÝÀàÐÍ
select
Ïà¹ØÎĵµ£º
alert index mem_ct monitoring usage;
desc v$object_usage;
set linesize 190
select * from v$object_usage;
SQL>SET AUTOTRACE ON;
¡¡¡¡*autotrace¹¦ÄÜÖ»ÄÜÔÚSQL*PLUSÀïʹÓÃ
¡¡¡¡ÆäËûһЩʹÓ÷½·¨£º
¡¡¡¡2.2.1¡¢ÔÚSQLPLUSÖеõ½Óï¾ä×ܵÄÖ´ÐÐʱ¼ä
¡¡¡¡SQL> set timing on;
2.2.2¡¢Ö»ÏÔʾִÐмƻ®--(»áÍ¬Ê ......
* ×î½üÒòΪ¿ª·¢»î¶¯ÐèÒª,ÓÃÉÏÁËEclipse,²¢ÒªÇóʹÓþ«¼ò°æµÄSQL(¼´ 2005)À´½øÐпª·¢ÏîÄ¿ *
1.×¼±¸¹¤×÷: ×¼±¸Ïà¹ØµÄÈí¼þ(Eclipse³ýÍâ,¿ªÔ´Èí¼þ¿ÉÒÔ´Ó¹ÙÍøÏÂÔØ)
<1>.Microsoft 2005 Express Edition
ÏÂÔصØÖ·:http://download.microsoft.com/download/0/9/0 ......
SQL 2005 µÄ´æ´¢¹ý³ÌºÍ´¥·¢Æ÷µ÷ÊԴ󷨣¨Ô´´£©
www.chengchen.net ³Ì³¿
×òÌìÍíÉÏÎÒÕÒ±éÁË»¥ÁªÍøҲûÓз¢ÏÖ¹ØÓÚSQL2005´æ´¢¹ý³ÌºÍ´¥·¢Æ÷µÄµ÷ÊÔ·½·¨£¬Ñо¿µ½Á賿2µã¶àÖÓ£¬ÖÕÓÚÕÒµ½·½·¨ÁË£¬²»¸É¶ÀÏí£¬ÄóöÀ´·ÖÏí¡£Èç¹ûҪתÔØ£¬Çë±£Áô°æȨ£¬Ð»Ð»£¡
&nbs ......
´¦ÀíÍøÕ¾²éѯ°üº¬”Ö®”×Ö³öÏ֔ȫÎÄËÑË÷Ìõ¼þÖаüº¬¸ÉÈÅ´Ê”ÏÖÏóµÄ×ܽ᣺
author:perfectaction
Sql server 2008È«ÎÄË÷ÒýµÄ¸ÉÈŴʱíĬÈÏÔÚResource¿âϵͳ±íÄÚ£¬ÎÞ·¨¸ü¸Ä£¬µ«sql2008ÌṩÁË×Ô¶¨Òå¸ÉÈŴʱíµÄ¹¦ÄÜ£¬¿É°ó¶¨µ½Ä³¸öÈ«ÎÄË÷ÒýÉÏ¡£
Ïà¹Ø²Ù×÷ÈçÏ£º
--sql server 2008 È«ÎÄË÷Òý½¨Á¢¼°´´½¨È«ÎÄ ......