SQL²é±íÃû¡¢×Ö¶ÎÃû¡¢±í˵Ã÷¡¢×Ö¶Î˵Ã÷
SQL ²é¿´ËùÓбíÃû£º
select name from sysobjects where type='U'
²éѯ±íµÄËùÓÐ×Ö¶ÎÃû£º
Select name from syscolumns Where ID=OBJECT_ID('±íÃû')
select * from information_schema.tables
select * from information_schema.views
select * from information_schema.columns
ACCESS
²é¿´ËùÓбíÃû£º
select name from MSysObjects where type=1 and flags=0
MSysObjectsÊÇϵͳ¶ÔÏó£¬Ä¬ÈÏÇé¿öÊÇÒþ²ØµÄ¡£Í¨¹ý¹¤¾ß¡¢Ñ¡Ïî¡¢ÊÓͼ¡¢ÏÔʾ¡¢ÏµÍ³¶ÔÏó¿ÉÒÔʹ֮ÏÔʾ³öÀ´¡£
SQL²éѯ±íµÄ±¸×¢ËµÃ÷
SELECT ±íÃû = case when a.colorder = 1 then d.name
else '' end,
±í˵Ã÷ = case when a.colorder = 1 then isnull(f.value, '')
else '' end
from syscolumns a
inner join sysobjects d
on a.id = d.id
and d.xtype = 'U'
and d.name <> 'sys.extended_properties'
left join sys.extended_properties f
on a.id = f.major_id
and f.minor_id = 0
SQL²éѯ±íµÄËùÓÐ×ֶεı¸×¢ËµÃ÷
SQL_1£º
SELECT Sysobjects.name AS TABLE_NAME, syscolumns.Id, syscolumns.name AS COLUMN_NAME,
systypes.name AS DATA_TYPE, syscolumns.length as CHARACTER_MAXIMUM_LENGTH,
sys.extended_properties.[value] AS COLUMN_DESCRIPTION, syscomments.text as
COLUMN_DEFAULT,syscolumns.isnullable as IS_NULLABLE from syscolumns
INNER JOIN systypes
ON syscolumns.xtype = systypes.xtype
LEFT JOIN sysobjects ON syscolumns.id = syso
Ïà¹ØÎĵµ£º
ÏÂÔØµØÖ·£ºhttp://msftdbprodsamples.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=19353
ÎÒÏÂÔØµÄÊÇSQL2008.AdventureWorks_All_Databases.x86.msi£¬±¾²»ÏëÏÂÔØÕâÖÖ°²×°Îļþ£¬µ«½Å±¾Îļþ×ÜÊÇÖ´Ðгö´í£¬ÔÒòû¾ßÌåÉ¡£ÕâÖÖ°²×°Îļþ°²×°ºó»á´´½¨Áù¸ö¿âAdventureWorks¡¢AdventureWorks2008¡¢AdventureWorksDW¡¢Ad ......
USE MASTER
GO
--´´½¨Êý¾Ý¿âÎļþ´æ·ÅĿ¼
EXEC XP_CMDSHELL 'MKDIR D:\LOANSTUMIS'
IF EXISTS(SELECT *
from SYSDATABASES
WHERE NAME = 'LOANSTU')
DROP DATABASE LOANSTU
GO
--´´½¨Êý¾Ý¿â
CREATE DATABASE LOANSTU
ON
(
NAME = 'LOANSTU_DATA',
FILENAME = 'D:\LOANSTUMIS\LOANSTU_DATA.MDF',
......
´¦ÀíÍøÕ¾²éѯ°üº¬”Ö®”×Ö³öÏ֔ȫÎÄËÑË÷Ìõ¼þÖаüº¬¸ÉÈÅ´Ê”ÏÖÏóµÄ×ܽ᣺
author:perfectaction
Sql server 2008È«ÎÄË÷ÒýµÄ¸ÉÈŴʱíĬÈÏÔÚResource¿âϵͳ±íÄÚ£¬ÎÞ·¨¸ü¸Ä£¬µ«sql2008ÌṩÁË×Ô¶¨Òå¸ÉÈŴʱíµÄ¹¦ÄÜ£¬¿É°ó¶¨µ½Ä³¸öÈ«ÎÄË÷ÒýÉÏ¡£
Ïà¹Ø²Ù×÷ÈçÏ£º
--sql server 2008 È«ÎÄË÷Òý½¨Á¢¼°´´½¨È«ÎÄ ......
±¾ÎÄÑÝʾÁË SQL Server 2008 ·ÖÇø±íʵÀý;
1. ´´½¨²âÊÔÊý¾Ý¿â £»
2. ´´½¨·ÖÇøº¯Êý;
3. ´´½¨·ÖÇø¼Ü¹¹;
4. ´´½¨·ÖÇø±í;
5. ´´½¨·ÖÇøË÷Òý ;
6. ·ÖÇøÇл» ;
7. ²éѯÄÄЩ±íʹÓÃÁË·ÖÇø±í£»
-- ×÷³ÉÕß leno
-- ÈÕÆÚ: 2009-06-06 23:50:01.700
-- ......
ÉÏ»ØÎÒÃÇ˵µ½ÆÀ¹ÀÒ»ÌõÓï¾äÖ´ÐÐЧÂÊÖ÷Òª¿´Âß¼ IO £¨É¶ÊÇÂß¼ IO £¬É¶ÊÇÎïÀí IO ¼ûÁª»úÎĵµ£©£¬Õâ´ÎÎÒÃǼÌÐø¡£
ÎÒÃÇÏÈ˵˵£¬·µ»Ø¶àÐнá¹ûʱ£¬ÎªÊ²Ã´ SQLServer ÓÐʱ»áÑ¡Ôñ index seek £¬ÓÐʱ»áÑ¡Ôñ index scan ¡£
ÒÔ nonclustered index ΪÀý˵Ã÷¡£
ÏñËùÓеÄË÷Òý B Ê÷Ò»Ñù£¬·Ç¾Û¼¯Ë÷ÒýÊ÷Ò²°üÀ¨ÍêÈ«ÓÉË÷ÒýÊý¾Ý×é³ÉµÄ¸ù½ ......