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

Sql Server Éú³ÉÊý¾Ý×Öµä

use Dbname  
go  
select   
    [±íÃû]=c.Name,  
    [±í˵Ã÷]=isnull(f.[value],''),  
    [ÁÐÃû]=a.Name,  
    [ÁÐÐò號]=a.Column_id,  
    [±êʶ]=case when is_identity=1 then '√' else '' end,  
    [Ö÷鍵]=case when exists(select 1 from sys.objects x join sys.indexes y on x.Type=N'PK' and x.Name=y.Name   
                        join sysindexkeys z on z.ID=a.Object_id and z.indid=y.index_id and z.Colid=a.Column_id)  
                    then '√' else '' end,  
    [ÀàÐÍ]=b.Name,  
    [×Ö½ÚÊý]=case when a.[max_length]=-1 and b.Name!='xml' then 'max/2G'   
            when b.Name='xml' then '2^31-1×Ö節/2G' 
            else rtrim(a.[max_length]) end,  
    [³¤¶È]=case when ColumnProperty(a.object_id,a.Name,'Precision')=-1 then '2^31-1' 
                else rtrim(ColumnProperty(a.object_id,a.Name,'Precision')) end,  
    [СÊý]=isnull(ColumnProperty(a.object_id,a.Name,'Scale'),0),  
    [ÊÇ·ñΪ¿Õ]=case when a.is_nullable=1 then '√' else '' end,  
    [ÁÐ˵Ã÷]=isnull(e.[value],''),  
    [ĬÈÏÖµ]=isnull(d.text,'')      
from   
    sys.columns a &


Ïà¹ØÎĵµ£º

SQL ServerÀïµÄ ISNULL Óë Oracle ÖÐµÄ NULLIF

SQL ServerÀïµÄ ISNULL Óë Oracle ÖÐµÄ NULLIF²»Í¬:
  SQL Server ÖÐÓÐÁ½¸ö²ÎÊý£¬Óï·¨£º
    ISNULL(check_expression, replacement_value)
    check_expression Óë replacement_value Êý¾ÝÀàÐͱØÐëÒ»ÖÂ
   
Èç¹û check_expression Ϊ NULL£¬Ôò·µ»Ø replacement_v ......

SQL ÈçºÎɾ³ýÊý¾Ý±íÖÐÖظ´µÄÊý¾Ý£¿

¡¾ÒýÓãºÃÍáï¼¼ÊõÎÄÕÂÕªÒª
¡¿
¾­²âÊÔ£¬·½·¨¶þ¿É³É¹¦É¾³ýÊý¾Ý£¬·½·¨Ò»¡¢Èý ɾ³ýÊý¾Ýʧ°Ü¡£Çë·¹ýµÄÅóÓÑ£¬Ö¸µãÃÔ½ò¡£¡£¡£
ÎÊÌ⣺һ¸ö±íÓÐ×ÔÔöµÄID
ÁУ¬±íÖÐÓÐһЩ¼Ç¼ÄÚÈÝÖظ´£¬Ò²¾ÍÊÇ˵ÕâЩ¼Ç¼³ýÁËID
²»Í¬Ö®Í⣬ÆäËûµÄÐÅÏ¢¶¼Ïàͬ¡£ÐèÒª°ÑÖظ´µÄ¼Ç¼±£ÁôÒ»Ìõ£¬Ê£ÏµÄɾ³ý
 
·½·¨Ò»£º»¹ÊÇ2000
ÄêµÄʱºòһλOracl ......

ʹÓÃSQL Serverµ¼Èë/µ¼³öExcel

ʹÓÃSQL Serverµ¼Èë/µ¼³öExcel,°üº¬²¿·Ö´íÎóÐÅÏ¢´¦Àí·½·¨;
²Ù×÷ÊÖ¼Ç,Áô´Ë±¸²é
/*
µ¼Èë
*/
--´íÎóÐÅÏ¢ÈçÏÂʱ£º
--Msg 15281, Level 16, State 1, Line 2
--SQL Server blocked access to STATEMENT 'OpenRowset/OpenDatasource' of component 'Ad Hoc Distributed Queries' because this component is turned off as ......

sqlÈçºÎ²úÉú¶àÌõ¼Ç¼

SELECT ROWNUM AS ID
,TO_CHAR(SYSDATE + ROWNUM / 24 / 3600, 'yyyy-mm-dd hh24:mi:ss') AS INC_DATETIME
,TRUNC(DBMS_RANDOM.VALUE(0, 100)) AS RANDOM_ID
,DBMS_RANDOM.STRING('x', 20) RANDOM_STRING
from DUAL
CONNECT BY LEVEL <= 10;
SELECT '('||WMSYS.WM_CONCAT(':P' || ROWNUM)| ......

SQLº¯Êý


SQLº¯Êý
ÔÚSQLÖУ¬º¯Êý¶ÔÊý¾Ý»òÊý¾Ý×éÖ´ÐвÙ×÷£¬È»ºó·µ»ØÐèÒªµÄÖµ¡£º¯Êý±í´ïʽ¿ÉÒÔ³öÏÖÔÚSELECTÁбíÖУ¬»òÕß
ÔÚÈκÎÔÊÐí³öÏÖµÄλÖÃÉÏ¡£SQL°üº¬ÁËÆßÖÖº¯Êý:
(1)¾ÛºÏº¯Êý:·µ»Ø»ã×ÜÖµ¡£
(2)תÐͺ¯Êý:½«Ò»ÖÖÊý¾ÝÀàÐÍת»»ÎªÁíÍâÒ»ÖÖ¡£
(3)ÈÕÆÚº¯Êý:´¦ÀíÈÕÆÚºÍʱ¼ä¡£
(4)Êýѧº¯Êý:Ö´ÐÐËãÊõÔËËã¡£
(5)×Ö·û´®º¯Êý:¶Ô×Ö·û´ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ