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

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


Ïà¹ØÎĵµ£º

sql 2005 ²»Í¬Êý¾Ý¿âµÄÊý¾Ý±í¸´ÖÆ

 sql 2005±íµÄ¸´ÖÆÓÐÁ½ÖÖ£ºÒ»ÖÖ¾ÍÊÇ°ÑÕû¸ö±í¸´ÖƹýÈ¥£¬¾ÍºÃÏñ¸´ÖÆÎļþ²¢ÇÒÖØÃüÃû¡£±ðÍâÒ»ÖÖ¾ÍÊǰѱíµÄÄÚÈݸ´Öƹý³ö.
select * into newtable form oldtable;°Ñoldtabel¸´ÖƵ½newtableÇÒnewtable²»´æÔÚ,·ñÔò³ö´í.;
insert into newtable select * from oldtable°ÑoldtableµÄÄÚÈݲåÈëµ½newtable, newtableÒ»¶¨Òª´æÔÚ, ......

[SQL Server 2008]SQL Server 2008 °²×°Ê¾ÀýÊý¾Ý¿â

ÏÂÔصØÖ·£ºhttp://msftdbprodsamples.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=19353
ÎÒÏÂÔصÄÊÇSQL2008.AdventureWorks_All_Databases.x86.msi£¬±¾²»ÏëÏÂÔØÕâÖÖ°²×°Îļþ£¬µ«½Å±¾Îļþ×ÜÊÇÖ´Ðгö´í£¬Ô­Òòû¾ßÌåÉ¡£ÕâÖÖ°²×°Îļþ°²×°ºó»á´´½¨Áù¸ö¿âAdventureWorks¡¢AdventureWorks2008¡¢AdventureWorksDW¡¢Ad ......

SQL ´û¿î±ÏÒµÉúÐÅÏ¢¹ÜÀíϵͳÊý¾Ý¿âÉè¼Æ

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',
......

SQL SERVERÐÔÄÜ·ÖÎö ËÀËø¼ì²âÊý¾Ý¿â×èÈûÓï¾ä

×÷ÖÐÊý¾Ý¿â¾­³£³ö´íËÀËø£¬²¢ÇÒ»¹ÒªÒªÇó½â¾öµ±Ç°µÄËÀËø£¬ÎÊÌâ¶à¶à£»
²ÎÕÕCSDN£¬Öйú·ç(Roy)һƪËÀËøÎÄÕ²¢¸Ä½øÁËÏ£»
/***********************************************************************************************************************
ÕûÀíÈË£ººÚľÑÂÉϵÄÎÏÅ£(lenolotus) ÈÕÆÚ:2009.04.28
************ ......

¸ßЧSQL²éѯ֮Ë÷Òý£¨III£©

ÏÈ˵˵ÕâЩÎóÇø¡£Ëùν“ÎóÇø”£¬ÓÐһЩÊÇÐÂÊÖºÜÈÝÒ×·¸µÄ´íÎó»òÕߺÜÈÝÒ׺öÂÔµÄÎÊÌ⣬ÁíÍâһЩ£¬ÔòÊÇÏñ“ºÄ×Ó³ÔÁËÑλá±ä³Éòùòð”Ò»Ñù£¬ÈÃÎÒÃÇ´ÓС¾ÍÈÏΪÊÇÕýÈ·µÄÊÂÇé¡£ÈçÏ£º
1¡¢   ±íÉϲ»¹ÜÓõÃ×ÅÓò»×Å£¬¶¼¼Ó¸ö¾Û¼¯Ë÷Òý¡£
ÎÒÃÇÖªµÀ£¬±íÒÔÁ½ÖÖ·½Ê½×éÖ¯ÎïÀí´æ´¢£ºÓоۼ¯Ë÷ÒýµÄ“¾Û¼¯± ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ