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

Sqlʱ¼äº¯Êý

Sqlʱ¼äº¯Êý
Ò»¡¢sql serverÈÕÆÚʱ¼äº¯Êý
Sql ServerÖеÄÈÕÆÚÓëʱ¼äº¯Êý 
1.  µ±Ç°ÏµÍ³ÈÕÆÚ¡¢Ê±¼ä 
    select getdate()  
2. dateadd  ÔÚÏòÖ¸¶¨ÈÕÆÚ¼ÓÉÏÒ»¶Îʱ¼äµÄ»ù´¡ÉÏ£¬·µ»ØеĠdatetime Öµ
   ÀýÈ磺ÏòÈÕÆÚ¼ÓÉÏ2Ìì 
   select dateadd(day,2,'2004-10-15')  --·µ»Ø£º2004-10-17 00:00:00.000 
3. datediff ·µ»Ø¿çÁ½¸öÖ¸¶¨ÈÕÆÚµÄÈÕÆÚºÍʱ¼ä±ß½çÊý¡£
   select datediff(day,'2004-09-01','2004-09-18')   --·µ»Ø£º17
4. datepart ·µ»Ø´ú±íÖ¸¶¨ÈÕÆÚµÄÖ¸¶¨ÈÕÆÚ²¿·ÖµÄÕûÊý¡£
  select DATEPART(month, '2004-10-15')  --·µ»Ø 10
5. datename ·µ»Ø´ú±íÖ¸¶¨ÈÕÆÚµÄÖ¸¶¨ÈÕÆÚ²¿·ÖµÄ×Ö·û´®
   select datename(weekday, '2004-10-15')  --·µ»Ø£ºÐÇÆÚÎå
6. day(), month(),year() --¿ÉÒÔÓëdatepart¶ÔÕÕÒ»ÏÂ
select µ±Ç°ÈÕÆÚ=convert(varchar(10),getdate(),120) 
,µ±Ç°Ê±¼ä=convert(varchar(8),getdate(),114) 
select datename(dw,'2004-10-15') 
select ±¾ÄêµÚ¶àÉÙÖÜ=datename(week,'2004-10-15')
      ,½ñÌìÊÇÖܼ¸=datename(weekday,'2004-10-15')
¶þ¡¢ÈÕÆÚ¸ñʽת»»
    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 )
 2004/09/12
 
 select CONVERT(varchar(12) , getdate(), 112 )
 20040912
 select CONVERT(varchar(12) , getdate(), 102 )
 2004.09.12
 
 ÆäËüÎÒ²»³£ÓõÄÈÕÆÚ¸ñʽת»»·½·¨:
 select CONVERT(varchar(12) , getdate(), 101 )
 09/12/2004
 select&


Ïà¹ØÎĵµ£º

JAVA+Swing +sql ·ÖÒ³´úÂë

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
impo ......

¹ØÓÚsql where id in ת»»³ÉÊý¾ÝÀàÐÍ int ʱʧ°Ü

ÓÐÖ´ÐÐsqlÌõ¼þÓï¾äwhere id in(@²ÎÊý)µÄʱºò£¬Èç¹û´¦Àí²»µ±£¬¾Í»á³öÏÖÎÊÌ⣺
ÈçÏÂÃæÕâ¸ö´æ´¢¹ý³Ì£º
alter proc Web_gettwtwgoldgameserverGoldSell
@ID int
as
declare @twgoldsellID nvarchar(1000)
select @twgoldsellID=twgoldsellID from twgoldgameserver where ID=@ID
set @twgoldsellID=replace(@twgoldsell ......

¡¾×ªÔØ¡¿SQL ServerÊý¾ÝÀàÐÍÏê½â

Êý¾ÝÀàÐÍÊÇÊý¾ÝµÄÒ»ÖÖÊôÐÔ£¬ÊÇÊý¾ÝËù±íʾÐÅÏ¢µÄÀàÐÍ¡£ÈκÎÒ»ÖÖÓïÑÔ¶¼ÓÐËü×Ô¼ºËù¹ÌÓеÄÊý¾ÝÀàÐÍ£¬SQL ServerÌṩһÏÂ25ÖÖ¹ÌÓеÄÊý¾ÝÀàÐÍ¡£
SQL ServerÊý¾ÝÀàÐÍÒ»ÀÀ±í
¡¡¡¡·Binary [(n)]
·Varbinary [(n)]
·Char [(n)]
·Varchar[(n)]
·Nchar[(n)]
·Nvarchar[(n)]
· ......

SQLÖ®11 Êý¾Ý¿âÉè¼Æ

º¯ÊýÒÀÀµ
==========================================
Ò»¡¢º¯ÊýÒÀÀµ¸ÅÄî  
    
  ¡¡¡¡º¯ÊýÒÀÀµÊÇ´ÓÊýѧ½Ç¶ÈÀ´¶¨ÒåµÄ£¬ÔÚ¹ØϵÖÐÓÃÀ´¿Ì»­¹Øϵ¸÷ÊôÐÔÖ®¼äÏ໥ÖÆÔ¼¶øÓÖÏ໥ÒÀÀµµÄÇé¿ö¡£º¯ÊýÒÀÀµÆÕ±é´æÔÚÓÚÏÖʵÉú»îÖУ¬±ÈÈ磬ÃèÊöÒ»¸öѧÉúµÄ¹Øϵ£¬¿ÉÒÔÓÐѧºÅ¡¢ÐÕÃû¡¢ËùÔÚϵµÈ¶à¸öÊôÐÔ£ ......

SQL¸ß¼¶Ê¹ÓÃÊý¾Ý¿â

SQL¸ß¼¶Ê¹ÓÃ
SELECT¸ß¼¶²éѯ
´íÎó´¦Àí
ÊÂÎñ´¦Àí
Êý¾ÝµÄËø¶¨
Óαê
1.SELECT¸ß¼¶²éѯ
Ç°ÃæÒѾ­½éÉÜÁËSELECTÓï¾äµÄÓ÷¨£¬±¾½ÚÖ÷Òª½éÉÜÊý¾Ý»ã×Ü¡¢Áª½Ó²éѯ¡¢×Ó²éѯºÍ¹Ø¼ü´ÊUNIONµÄʹÓá£
(1)Êý¾Ý»ã×Ü
Ϊ¾ö²ßÖ§³ÖϵͳÉú³É¾ÛºÏÊÂÎñµÄ»ã×ܱ¨±íÊÇÒ»ÏÔÓ²¢ÇÒÏ൱ÏûºÄ×ÊÔ´µÄ¹¤×÷¡£SQL Server 2000ÌṩÁ½¸öÁé»îÇÒÇ¿´óµÄ×é¼þ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ