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

SQL²éѯÿÐÐÖÐ×î´óÖµµÄ¼¼ÇÉ

--------------------------------------------------------------------------
--  Author : htl258(Tony)
--  Date   : 2010-04-23 08:08:36
--  Version:Microsoft SQL Server 2008 (RTM) - 10.0.1600.22 (Intel X86)
--          Jul  9 2008 14:43:34
--          Copyright (c) 1988-2008 Microsoft Corporation
--          Developer Edition on Windows NT 5.1 <X86> (Build 2600: Service Pack 3)
--  Blog   : http://blog.csdn.net/htl258
--  Subject: SQL²éѯÿÐÐÖÐ×î´óÖµµÄ¼¼ÇÉ
--------------------------------------------------------------------------
--> Éú³É²âÊÔÊý¾Ý±í:tb
 
IF NOT OBJECT_ID('[tb]') IS NULL
    DROP TABLE [tb]
GO
CREATE TABLE [tb](
a SMALLINT,
b SMALLINT,
c SMALLINT,
d SMALLINT,
e SMALLINT,
f SMALLINT,
g SMALLINT
)
INSERT [tb]
SELECT 1,2,3,4,5,2,3 UNION ALL
SELECT 4,5,6,7,7,2,0 UNION ALL
SELECT 4,9,6,7,7,9,6
GO
--SELECT * from [tb]
 
-->SQL²éѯÈçÏÂ:
 
SELECT *,
    (SELECT MAX(a)
     from(
       SELECT a UNION ALL
       SELECT b UNION ALL
       SELECT c UNION ALL
       SELECT d UNION ALL
       SELECT e UNION ALL
       SELECT f UNION ALL
       SELECT g
       ) AS t  
    ) AS maxvalue
from tb
 
 
/*
a      b      c      d      e      f      g      maxvalue
------ ------ ------ ------ ------ ------ ------ --------


Ïà¹ØÎĵµ£º

SQL ʹÓà CONVERT

ʹÓà CONVERT£º
CONVERT (data_type[(length)], expression [, style])
select CONVERT(varchar, getdate(), 120 )
2004-09-12 11:06:08
select replace(replace(replace(CONVERT(varchar, getdate(), 120 ),\'-\',\'\'),\' \',\'\'),\':\',\'\')
20040912110608
select CONVERT(varchar(12) , getdate(), 111 ) ......

sql ¸÷ÖÖ×Ö·û´®ºÏ²¢·½·¨ µÚ¶þÖÖ·½·¨ºÃ(ÀûÓú¯Êý)

--3.3.1 ʹÓÃÓα귨½øÐÐ×Ö·û´®ºÏ²¢´¦ÀíµÄʾÀý¡£
--´¦ÀíµÄÊý¾Ý
CREATE TABLE tb(col1 varchar(10),col2 int)
INSERT tb SELECT 'a',1
UNION ALL SELECT 'a',2
UNION ALL SELECT 'b',1
UNION ALL SELECT 'b',2
UNION ALL SELECT 'b',3
--ºÏ²¢´¦Àí
--¶¨Òå½á¹û¼¯±í±äÁ¿
DECLARE @t TABLE(col1 varchar(10),col2 varch ......

SQL ServerË÷Òýͳ¼ÆÐÅϢδ¼°Ê±¸üУ¬µ¼ÖÂÅÅÐò»ìÂÒ

½ñÌ죬Óöµ½ÁËÕâÑùµÄÒ»¸öÀý×Ó£º
SQL ServerË÷Òýͳ¼ÆÐÅϢδ¼°Ê±¸üУ¬µ¼ÖÂÅÅÐò»ìÂÒ
ÎÒÃÇÖªµÀ£¬ÔÚsql
serverÉÏ´´½¨Ë÷Òýºó£¬Í¬Ê±»á¶Ô¸ÃË÷ÒýÉϵÄÖµ½øÐÐÅÅÐò£¬µ«¶ÔÓÚÐÂÔö¼ÓµÄÖµ£¬Èç¹ûδÄܼ°Ê±¸üÐÂͳ¼ÆÐÅÏ¢£¬½«ÓпÉÄܵ¼ÖÂÅÅÐòµÄ»ìÂÒ£¬Ò²¾ÍÊÇûÓÐÅÅÐò¡£
ÕâÊDzúÉúÎÊÌâµÄÓï¾ä£º
Select * from V_L_IcStockProInEntry Where FInt ......

windows 2003ϰ²×° sql server 2000µÄ·½·¨

    ÎÒ°²×°µÄÊÇsql server 2000ËĺÏÒ»°æ±¾£¬Õý³£Í¾¾¶Ö±½Ó°²×°ÊÇ×°²»Éϵģ¬Òª´òʲôSP3²¹¶¡£¬²»ÒªÀíËü£¬´ò¿ª°²×°°ü£¬Àï±ßÓиöMSDEĿ¼£¬Ö´ÐÐsetup.exe£¬°²×°ºÜ˳Àû£¬×°ÍêÖ®ºóÊÇûÓз´Ó¦µÄ£¬ÖØÆô¼ÆËã»ú£¬È»ºóÄÜ¿´µ½sql server·þÎñÒѾ­Æô¶¯£¬ÕâÑù£¬¾Í¿ÉÒÔÕý³£°²×°ÁË£¬Ö´Ðа²×°°ü¸ùĿ¼Ïµİ²×°³ÌÐò£¬°´Ìáʾһ²½ ......

³£ÓÃSQLÃæÊÔÌâ £¨Ò»£©

Êý¾Ý¿âÃæÊÔ³£ÓòâÊÔÌâ(SQL Server)
ÌâÄ¿1
¡¡¡¡ÎÊÌâÃèÊö:
¡¡¡¡Îª¹ÜÀí¸ÚλҵÎñÅàѵÐÅÏ¢£¬½¨Á¢3¸ö±í:
¡¡¡¡S (S#,SN,SD,SA) S#,SN,SD,SA ·Ö±ð´ú±íѧºÅ¡¢Ñ§Ô±ÐÕÃû¡¢ËùÊôµ¥Î»¡¢Ñ§Ô±ÄêÁä
¡¡¡¡C (C#,CN ) C#,CN ·Ö±ð´ú±í¿Î³Ì±àºÅ¡¢¿Î³ÌÃû³Æ
¡¡¡¡SC ( S#,C#,G ) S#,C#,G ·Ö±ð´ú±íѧºÅ¡¢ËùÑ¡Ð޵Ŀγ̱àºÅ¡¢Ñ§Ï°³É¼¨
¡¡¡¡1. Ê¹Ó ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ