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

SQLÖÐÒÔÈÕÆÚΪÌõ¼þͳ¼Æ·½·¨

 /*ͳ¼ÆÃ¿ÌìÊý¾Ý×ÜÁ¿ÈýÖÖ·½·¨£º
        select convert(char(10),happentime ,120) as date ,count(1) from table1
        group by convert(char(10),happentime ,120) order by date desc
       select day(happentime) as date,count(*) from  table1 
       group by day(happentime) order by date desc
         SELECT left([happentime],5),count (1)
         from [database].[dbo].[ table1]
         group by left([happentime],5)
         order by left([happentime],5)
˵Ã÷£ºhappentimeΪ±í×Ö¶ÎÃû;
´ó¼Ò·Ö±ð²âÊÔÏ left([happentime],20)  Óë convert(char(10),happentime ,120) ¡¢day(happentime) Á½ÕßµÄÇø±ð£¬¶ÔÓÚÐÂÈËÀ´Ëµ£¬´Óleft([happentime],5) À´¿´½á¹ûÍùÍù¿´²»³öÀ´ÓëÆäËûÁ½¸öµÄ²»Í¬¡£
Èç¹û²»Ã÷°×Óï¾äÈçºÎд£¬Çë²Î¿¼ÈçÏÂ:
select convert(char(10),happentime ,120) from table1
SELECT left([happentime],5) from table1
SELECT left([happentime],5) from table1


Ïà¹ØÎĵµ£º

SQL ½ØÈ¡×Ö·û´®£¬ÖÐÎÄËãÁ½¸ö×Ö·ûµÄ·½·¨

--SQL ½ØÈ¡×Ö·û´®·½·¨£¬ÖÐÎÄËãÁ½¸ö×Ö·ûµÄ·½·¨¡£
--·½·¨¸úË®¸çѧϰµÄ£¬Ö§³ÖÒ»ÏÂË®¸çµÄ²©¿Í
--http://hi.csdn.net/link.php?url=http://blog.csdn.net%2Fwufeng4552
--Ë®¸ç×î½üлÁ˺ö಩¿Í£¬ÓÐʱ¼äÒ»¶¨È¥ºÃºÃѧϰ
--LEFT() ºÍSUBSTRING()¶¼Êǽ«ºº×ÖËãÒ»¸ö×Ö·ûÀ´ËãµÄ
--Èç¹û²»¼Æ½ÏµÄ»°£¬ÍƼöʹÓÃÕâÁ½¸öϵͳº¯Êý
IF OBJE ......

SQLÁª±í¸üУ¬Áª±í²éѯ

ûÓÐÒýÓùØÏµµÄ±í
 £±.¡¡Áª±í¸üÐÂ
update  a set a.education = '±¾¿Æ' from NT_UserInfo a ,NT_User b where  a.UserID=b.UserID and b.email = 'carlfan2008@163.com'
£².¡¡Áª±í²éѯ
select a.*,b.* from nt_user as a, nt_userinfo as b where a.userid = b.userid and Email = 'carlfan2008@163.com ......

AccessÊý¾Ý¿âÖвéѯÊý×éÀàÐÍ×ֶεÄASP´úÂëSQLÓï·¨

 ½ñÌìÔÚÐÞ¸ÄÒÔǰ¿ª·¢µÄÒ»¸öÍøÕ¾µÄʱºòÓöµ½Ò»¸öÎÊÌ⣬ÒòΪ¹¦ÄܵÄÐèÒª£¬ÒÔǰµÄÒ»¸öÊý×ÖÀàÐÍ×ֶθıäΪÎı¾×ֶΣ¬ÒòΪÕâ¸ö×Ö¶ÎÐèÒª°üº¬¶à¸öÀà±ðµÄID£¬ÒÔǰÕâ¸ö×Ö¶ÎÖ»¶ÔÓ¦Ò»¸öIDµÄ¡£
ÍøÕ¾ÊÇASP VBÓïÑԵģ¬Êý¾Ý¿âʹÓõÄÊÇAccess
ÐÞ¸ÄÊý¾ÝÀàÐÍÖ®ºóǰ̨µÄ²éѯ´úÂë¾Í²»ÄÜʹÓÃÖîÈçxID=1ÕâÖÖÌõ¼þÁË¡£ÓÉÓÚÏÖÔÚ¸Ã×ֶαäΪÎı¾ÀàÐ ......

¹ØÓÚsqlÖÐʱ¼äµÄ¸ñʽת»»


sql server2000ÖÐʹÓÃconvertÀ´È¡µÃdatetimeÊý¾ÝÀàÐÍÑùʽ£¨È«£©
ÈÕÆÚÊý¾Ý¸ñʽµÄ´¦Àí£¬Á½¸öʾÀý£º
CONVERT(varchar(16), ʱ¼äÒ», 20) ½á¹û£º2007-02-01 08:02/*ʱ¼äÒ»°ãΪgetdate()º¯Êý»òÊý¾Ý±íÀïµÄ×Ö¶Î*/
CONVERT(varchar(10), ʱ¼äÒ», 23) ½á¹û£º2007-02-01 /*varchar(10)±íʾÈÕÆÚÊä³öµÄ¸ñʽ£¬Èç¹û²»¹»³¤»á·¢Éú½ØÈ¡*/ ......

C# Ö´ÐÐSQLÊÂÎñʵÀý´úÂë

 [C#]
public void RunSqlTransaction(string myConnString)
{
    SqlConnection myConnection = new SqlConnection(myConnString);
    myConnection.Open();
    SqlCommand myCommand = myConnection.CreateCommand();
    SqlTransaction m ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ