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

SQL round()Ïê½â


SQLÖÐround£¨£©º¯ÊýÓ÷¨
SQL round()Ïê½â
roundÓÐÁ½¸öÖØÔØ,Ò»¸öÓдøÓÐÁ½¸ö²ÎÊýµÄ,Ò»¸öÊÇ´øÓÐÈý¸ö²ÎÊýµÄ,
ÿһ¸ö²ÎÊý¶¼ÏàͬÊÇÒª´¦ÀíµÄÊý,
1.´øÓÐÁ½¸ö²ÎÊý.ÿ¶þ¸ö²ÎÊýÊÇСÊýµãµÄ×ó±ßµÚ¼¸Î»»òÓұߵڼ¸Î»,·Ö±ðÓÃÕý¸º±íʾ.×ó±ßΪ¸º,ÓÒ±ßΪ¸º.ΪËÄÉáÎåÈë.
select round(748.585929,-1) 750.000000
select round(748.585929,2) 748.590000
2.´øÈý¸ö²ÎÊý.µÚ¶þ¸ö²ÎÊýͬÉÏ.µÚÈý¸ö²ÎÊýÓÐÁ½ÖÖ¿ÉÄÜ,Ò»ÖÖÊÇÈ¡0ΪËÄÉáÎåÈë.ÁíÒ»ÖÖÊÇÕý¸ºÖµ,ÔòΪÉáÈ¥
 select round(748.585929,3,0)  748.586000
select round(748.585929,3,1)  748.585000
select round(748.585929,3,-1)  748.585000
---------------------------------------------
TEST@ORA1] SQL>select round(4321,-3) from dual;
ROUND(4321,-3)
--------------
          4000
[TEST@ORA1] SQL>select round(20,-3) from dual;
ROUND(20,-3)
------------
           0
[TEST@ORA1] SQL>select round(4500,-3) from dual;
ROUND(4500,-3)
--------------
          5000


Ïà¹ØÎĵµ£º

SQL SERVER¶¨Òå²Ù×÷Ô±Êý¾Ý»Ö¸´

¶¨Òå²Ù×÷Ô±
SQL Server´úÀíÍê³ÉÒ»¸ö×÷Òµºó£¬Í¨Öª²Ù×÷Ô±µÄ·½·¨ÓжàÖÖ¡£
ÀýÈ磬ͨ¹ýÃüÁîϵͳ°ÑÏàÓ¦µÄÏûϢдÈëWindows NTʼþÈÕÖ¾ÖУ¬ÒÔ±ã֪ͨϵͳ¹ÜÀíÔ±·´¸´¶ÁÈ¡´ËÈÕÖ¾¡£
ÁíÍâÒ»ÖÖ¸üºÃµÄÑ¡Ôñ¾ÍÊÇʹÓõç×ÓÓʼþ¡¢´«ºô»ú»òÍøÂç´«ËͰѾ¯±¨ÏûϢ֪ͨ¸ø²Ù×÷Ô±¡£²Ù×÷Ô±ÊÇSQL Server´úÀí·¢ËÍÏûÏ¢µÄ½ÓÊÕÕߣ¬²Ù×÷Ô±¿ÉÒÔÔÚÒ»¸ö×÷ҵ֮ǰ ......

SQL ServerÈ«ÎÄË÷ÒýµÄ¸öÈË×ܽá(ÏÂ) ¹ØÓÚÖÐÎÄ·Ö´Ê


SQL ServerÈ«ÎÄË÷ÒýµÄ¸öÈË×ܽá(ÏÂ)-¹ØÓÚÖÐÎÄ·Ö´Ê
(2005-11-14 04:32:01)
תÔØ
 
·ÖÀࣺÉî¶ÈÑо¿
ÔÚʹÓÃSQL SearchµÄ¹ý³ÌÖУ¬»¹·¢ÏÖÁËÒ»¸öÎÊÌ⣺Ëü¶ÔÖÐÎÄ£¬ÊÇ°´×ִַʵģ¬ÏÂÃæÎÒ½âÊÍһϣº
±ÈÈç¶Ô'²©¿ÍÌóÉÔ±ºÜ¶àÊÇMVP'Õâ¾ä»°£¬¼ÙÈçÒ»¸ö¸öµÄ×ÖµÄ×÷Ë÷Òý£¬»á±ÈʹÓÃ'²©¿ÍÌÃ','³ÉÔ±',MVP'¼¸¸ö´Ê×÷Ë÷ÒýÉú³ÉµÄË ......

SQL ServerÈÕÆÚ

---Ò»¸öÔµĵÚÒ»Ìì
SELECT DATEADD(mm, DATEDIFF(mm,0,getdate()), 0) 
--- ±¾ÖܵÄÐÇÆÚÒ»
SELECT DATEADD(wk, DATEDIFF(wk,0,getdate()), 0)
---Ò»ÄêµÄµÚÒ»Ìì
SELECT DATEADD(yy, DATEDIFF(yy,0,getdate()), 0)
----¼¾¶ÈµÄµÚÒ»Ìì
SELECT DATEADD(qq, DATEDIFF(qq,0,getdate()), 0)
----ÉϸöÔµÄ×îºóÒ»Ìì
......

SQL Server 2008 ×èÖ¹±£´æÒªÇóÖØд´½¨±íµÄ¸ü¸Ä


MS SQL Server 2008 ÔÚ½¨Íê±íºó£¬Èç¹ûÒª²åÈëÈÎÒâÁУ¬ÔòÌáʾ£º
µ±Óû§ÔÚÔÚSQL Server 2008ÆóÒµ¹ÜÀíÆ÷Öиü¸Ä±í½á¹¹Ê±£¬±ØÐëÒªÏÈɾ³ýÔ­À´µÄ±í£¬È»ºóÖØд´½¨ÐÂ±í£¬²ÅÄÜÍê³É±íµÄ¸ü¸Ä£¬Èç¹ûÇ¿Ðиü¸Ä»á³öÏÖÒÔÏÂÌáʾ£º²»ÔÊÐí±£´æ¸ü¸Ä¡£ÄúËù×öµÄ¸ü¸ÄÒªÇóɾ³ý²¢ÖØд´½¨ÒÔÏÂ±í¡£Äú¶ÔÎÞ·¨ÖØд´½¨µÄ±ê½øÐÐÁ˸ü¸Ä»òÕßÆôÓÃÁË“× ......

SQL²åÈëÀýÌâ

--´´½¨±íTongXunLu
CREATE TABLE TongXunLu
 (
 [tName] nvarchar(30),
 [tAddress] nvarchar(50),
 [tEmail] varchar(50)
 )
--´´½¨±í students
CREATE TABLE students
 (
 [sId] int IDENTITY (1, 1) primary key NOT NULL ,
 [sName] varchar (50)   NOT ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ