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

SQLÈÕÆÚÀà´óÈ«£¨convert£©

---ÓÃconvertת»»²ÎÊý¶Ô±È
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 CONVERT(varchar(12) , getdate(), 103 )
12/09/2004
select CONVERT(varchar(12) , getdate(), 104 )
12.09.2004
select CONVERT(varchar(12) , getdate(), 105 )
12-09-2004
select CONVERT(varchar(12) , getdate(), 106 )
12 09 2004
select CONVERT(varchar(12) , getdate(), 107 )
09 12, 2004
select CONVERT(varchar(12) , getdate(), 108 )
11:06:08
select CONVERT(varchar(12) , getdate(), 109 )
09 12 2004 1
select CONVERT(varchar(12) , getdate(), 110 )
09-12-2004
select CONVERT(varchar(12) , getdate(), 113 )
12 09 2004 1
select CONVERT(varchar(12) , getdate(), 114 )
11:06:08.177


Ïà¹ØÎĵµ£º

C#ÖÐÓÃÓÚÁ¬½ÓSQLÊý¾Ý¿âµÄSQLHelperÀà

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;   //ÒýÓÃÃüÃû¿Õ¼ä
namespace DAL
{
    /*******************************************************************************
  &n ......

sql ÐÔÄܵ÷Õû

1. Ñ¡ÓÃÊʺϵÄORACLEÓÅ»¯Æ÷
   ORACLEµÄÓÅ»¯Æ÷¹²ÓÐ3ÖÖ:
   a.  RULE (»ùÓÚ¹æÔò)   b. COST (»ùÓڳɱ¾)  c. CHOOSE (Ñ¡ÔñÐÔ)
   ÉèÖÃȱʡµÄÓÅ»¯Æ÷,¿ÉÒÔͨ¹ý¶Ôinit.oraÎļþÖÐOPTIMIZER_MODE²ÎÊýµÄ¸÷ÖÖÉùÃ÷,ÈçRULE,COST,CHOOSE,ALL_ROWS,FIRST_ROWS . Ä㵱ȻҲÔÚSQL¾ä¼ ......

Sqlʱ¼äº¯Êý

Sqlʱ¼äº¯Êý
Ò»¡¢sql serverÈÕÆÚʱ¼äº¯Êý
Sql ServerÖеÄÈÕÆÚÓëʱ¼äº¯Êý 
1.  µ±Ç°ÏµÍ³ÈÕÆÚ¡¢Ê±¼ä 
    select getdate()  
2. dateadd  ÔÚÏòÖ¸¶¨ÈÕÆÚ¼ÓÉÏÒ»¶Îʱ¼äµÄ»ù´¡ÉÏ£¬·µ»ØÐµĠdatetime Öµ
   Àý ......

sqlÃæÊÔµÄ

1¡¢²éÕÒ±íÖжàÓàµÄÖØ¸´¼Ç¼£¬Öظ´¼Ç¼ÊǸù¾Ýµ¥¸ö×ֶΣ¨peopleId£©À´ÅжÏ
select * from people
where peopleId in (select   peopleId from   people group by   peopleId having count
(peopleId) >& ......

SQL¶¯Ì¬¼ÆËã³ö±íÖй«Ê½Ê¾Àý

##################################################
#        ÉùÃ÷£º
#        ±¾ÎÄת×ÔCSDN£¬Óû§ID£ºhtl258
#        Ô­ÌûµØÖ·£ºhttp://blog.csdn.net/htl258/archive/2010/05/13/5588454.aspx
####### ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ