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

SQLÖÐ ³£ÓõĴ¦Àí·½·¨

 -- Ò»£º ´¦Àíδ²éµ½µÄ¿ÕÖµ
 select
 case when exists(select EndPrice from T_stock where BOMSN='0109')
 then (select EndPrice from T_stock where BOMSN='0109')
 else 0 end
 --¶þ£º¸üÐÂ×Ö¶ÎÖµ
 --strNum ÊýÁ¿
 --strId  ÐòºÅ
 update T_buy_Pro set CompentNum=isnull(CompentNum,0)+'strNum' ,
 Status= case when isnull(BuyNumber,0) > isnull(CompentNum,0)+ 'strNum'
 then '²¿·ÖÊÕÁÏ' else 'È«²¿ÊÕÁÏ' end
 where BuyProID='strId'
È¥µôСÊýµãÓÐЧÊý×ÖºóÃæµÄËùÓÐ0
decimalÀàÐÍ£¬Ð¡ÊýλÊýÊÇ6룬Èç¹û²åÈëµÄÊý¾ÝΪ2.5£¬Ôò¼ìË÷ʱÏÔʾΪ2.500000
select   cast(2.500000       as     real)
----------½¨Ò»個º¯數Íê³É-------------   
  Create     Function     trun(@i     decimal(18,6))   
  returns       varchar(30)   
  begin     
  declare     @s     varchar(30)   
  set     @s=cast(@i     as   varchar(30))   
  while   len(@s)>0   
  begin           
            if   cast(substring(rtrim(@s),len(rtrim(@s))-1,1)     as     int)<>0         
            begin   
                    set     @s=substring(rtrim(@s),1,len(@s)-1)   
                    break   
            end   
            set     @s=substring(rtrim(@s),1,len(@s)-1)   
  end   
        return(@s)   
  end   
  ----------------------------結Êøº¯數--------


Ïà¹ØÎĵµ£º

Sql Server²éѯÊý¾Ý¼¯ÐÐÁл¥»»

Ðл»ÁУº
--> Éú³É²âÊÔÊý¾Ý±í: [tb]
IF OBJECT_ID('[tb]') IS NOT NULL
    DROP TABLE [tb]
GO
CREATE TABLE [tb] ([a] [int],[b] [int],[c] [int])
INSERT INTO [tb]
SELECT '3','9','5' UNION ALL
SELECT '5','2','7' UNION ALL
SELECT '6','3','8'
--SELECT * from [tb]
-->SQL²éѯÈçÏ ......

SQL Server 2005 ²éѯ·ÖÎöÖÐɾ³ýÊý¾Ý¿â

USE   master  
GO
DECLARE   @dbname   sysname  
SET  @dbname='TEST' --Õâ¸öÊÇҪɾ³ýµÄÊý¾Ý¿â¿âÃû  
DECLARE @s  NVARCHAR(1000)  
DECLARE tb CURSOR local FOR  
SELECT s='KILL '+CAST(spid AS NVARCHAR)&nbs ......

SQL ×ÔÔöÁУ¨·Ç×ÔÔö×ֶΣ©

--
> ²âÊÔÊý¾Ý£º[tb]
if

object_id
(
'
[tb]
'
)
is

not

null

drop

table

[
tb
]
go

create

table

[
tb
]
(
[
id
]

int
,
[
lx
]

int
)
insert

[
tb
]
select

29
,
2

union

all
select

30
,
3

union

all
sel ......

AccessÓëSql ServerÖ®ASP´úÂë±È½Ï

ºǫ́Êý¾Ý¿â£º
[Microsoft Access]
Óë
[Microsoft Sql Server]
¸ü»»Ö®ºó£¬ASP´úÂëӦעÒâÒªÐ޸ĵÄһЩµØ·½£º
[Ò»]Á¬½ÓÎÊÌ⣨¾ÙÀý)
[Microsoft Access]
constr = "DBQ=c:\data\clwz.mdb; DRIVER={Microsoft Access Driver (*.mdb)}"
[Microsoft Sql Server]
constr = "DRIVER={SQL Server};SERVER=host;DATA ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ