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

SqlÓï¾ä

Update  Channel set Unit ='mg' ,
RunUpThreshold='10' ,
RunDownThreshold='10' ,
SafetyUpThreshold='10' ,
SafetyDownThreshold='10' 
where Bridge='001' and DeviceCode='AS'
and SensorCode='001' and Supplement='N'
set  £º ','
where: and


Ïà¹ØÎĵµ£º

sql ÈÕÆÚ¼ÆËã

ÔÚÍøÉÏËÑÁË ºÃ¶à
ÓÐÆ´½Ó×Ö·û´®µÄ£¬²»¹ýÎÒ¾õµÃ ¼ÈÈ» sql ³ýÁË dateTime  Õâ¸öÀàÐÍ ¾Í²»»áÈÃÄã È¥½ØÈ¡×Ö·û´® £¨ÕâÑù¶àÂ鷳ѽ£©
ÓÚÊÇÔÙËÑ  £¬ÕÒµ½Ò»¸ö±È½ÏºÃµÄ  ÏÖÔÚ½éÉÜÒ»ÏÂ
DATEDIFF(DAY,addDate, '2010-04-23') = -1
ʲôÒâ˼ÄØ£¿ÌýÎÒÂýÂý·Ö½â
DATEDIFF  ²»ÓöàÉÙ  º¯ÊýÃû
DAY   ......

dz̸SQL×¢Èë µ±unionÓöÉÏntextÊý¾ÝÀàÐÍ

      ÔÚÎÒÃǽøÐÐsql×¢ÈëµÄ¹ý³ÌÖг£³£»áÓõ½union²éѯ·½·¨£¬´ó¶àÊýÇé¿öÏÂʹÓÃunion²éѯ·¨¿ÉÒÔÈÃÎÒÃǺܿìµÄÖªµÀÄ¿±êµÄÊý¾Ý×éÖ¯·½Ê½¡£È»¶øµ±ÎÒÃÇÓöµ½ntext¡¢text»òimageÊý¾ÝÀàÐÍʱ£¬union²éѯ¾Í²»Ì«¹ÜÓÃÁË¡£ÒÔsql serverΪÀý£¬ÔÚÕâÖÖÇé¿öÏ»áÅ׳öÈçÏ´íÎó£ºntext Êý¾ÝÀàÐͲ»ÄÜѡΪ DISTINCT£¬ÒòΪËü ......

Oracle PL/SQLÖÐÈçºÎʹÓÃ%TYPEºÍ%ROWTYPE

¡¡
¡¡¡¡1. ʹÓÃ%TYPE
¡¡¡¡ÔÚÐí¶àÇé¿öÏ£¬PL/SQL±äÁ¿¿ÉÒÔÓÃÀ´´æ´¢ÔÚÊý¾Ý¿â±íÖеÄÊý¾Ý¡£ÔÚÕâÖÖÇé¿öÏ£¬±äÁ¿Ó¦¸ÃÓµÓÐÓë±íÁÐÏàͬµÄÀàÐÍ¡£ÀýÈ磬students±íµÄfirst_nameÁеÄÀàÐÍΪVARCHAR2(20),ÎÒÃÇ¿ÉÒÔ°´ÕÕÏÂÊö·½Ê½ÉùÃ÷Ò»¸ö±äÁ¿£º
¡¡¡¡DECLARE
¡¡¡¡ v_FirstName VARCHAR2(20);
¡¡
¡¡µ«ÊÇÈç¹ûfirst_nameÁеĶ¨Òå¸Ä±äÁ ......

SQL DateTime²éѯÓë¸ñʽ

select * from orders where month(orderdate)= (select month(orderdate) from orders where orderid=10248)
1.Ò»¸öÔµÚÒ»ÌìµÄ
Select DATEADD(mm, DATEDIFF(mm,0,getdate()), 0)
2.±¾ÖܵÄÐÇÆÚÒ»
Select DATEADD(wk, DATEDIFF(wk,0,getdate()), 0)
3.Ò»ÄêµÄµÚÒ»Ìì
Select DATEADD(yy, DATEDIFF(yy,0,getdate()), 0) ......

SQL´æ´¢¹ý³ÌʵÀý


Àý1 ´«ÈëÒ»¸ö²ÎÊý@username,ÅжÏÓû§ÊÇ·ñ´æÔÚ
-------------------------------------------------------------------------------
CREATE PROC IsExistUser
(
@username varchar(20),
@IsExistTheUser varchar(25) OUTPUT--Êä³ö²ÎÊý
)
as
SELECT @IsExistTheUser = count(username)
from users
WHERE username ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ