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

sqlÀàÐÍת»»º¯ÊýcastºÍconvert

¼ò½é£º
        Êý¾ÝÀàÐÍת»»¿ÉÒÔͨ¹ýCAST()ºÍCONVERT()º¯ÊýÀ´ÊµÏÖ¡£´ó¶àÊýÇé¿öÏ£¬ÕâÁ½¸öº¯ÊýÊÇÖØµþµÄ£¬ËüÃÇ·´Ó³ÁËSQLÓïÑÔµÄÑÝ»¯ÀúÊ·¡£ÕâÁ½¸öº¯ÊýµÄ¹¦ÄÜÏàËÆ£¬²»¹ýËüÃǵÄÓï·¨²»Í¬¡£ËäÈ»²¢·ÇËùÓÐÀàÐ͵ÄÖµ¶¼ÄÜת±äΪÆäËûÊý¾ÝÀàÐÍ£¬µ«×ܵÄÀ´Ëµ£¬ÈκοÉÒÔת»»µÄÖµ¶¼¿ÉÒÔÓüòµ¥µÄº¯ÊýʵÏÖת»»¡£
 
Óï·¨£º
       CAST ( expression AS data_type ) 
      CONVERT (data_type[(length)], expression [, style])
 
ÓÃÀý£º
 A.¼ìË÷ÊéÃûµ±Ç°ÏúÊÛ¶îµÄµÚһλÊý×ÖΪ3£¬Í¨¹ý½«ytd_salesת»»Îªchar(20)ʵÏÖ¡£ 
  USE   pubs  
  GO  
  SELECT   SUBSTRING(title,   1,   30)   AS   Title,   ytd_sales  
  from   titles  
  WHERE   CAST(ytd_sales   AS   char(20))   LIKE   '3%'  
  GO
  USE   pubs  
  GO  
  SELECT   SUBSTRING(title,   1,   30)   AS   Title,   ytd_sales  
  from   titles  
  WHERE   CONVERT(char(20),   ytd_sales)   LIKE   '3%'  
  GO
 
 B.   ʹÓôøÓÐËãÊõÔËËã·ûµÄCAST
  USE   pubs  
  GO  
  SELECT   CAST(ROUND(ytd_sales/price,   0)   AS   int)   AS   'Copies'  
  from   titles  
  GO  
 
 C.   ʹÓÃCAST½øÐд®Áª
  USE   pubs  
  GO  
  SELECT   'The   price   is   '   +   CAST(price   AS   varchar(12))  
  from   titles  
  WHERE   price   >   10.00  
  GO  
 
D.ʹÓÃCAST»ñµÃ¸ü¶àÒ×¶ÁÎı¾  
  USE   pubs  
  GO  
  SELECT   CAST(title   AS   char(50)), &n


Ïà¹ØÎĵµ£º

[ÊÕ£] ÓÃsqlite Ö´Ðбê×¼ sql Óï·¨

http://www.umgr.com/blog/PostView.aspx?bpId=36294
 1. Ö´ÐÐsqlÓï¾ä
int sqlite3_exec(sqlite3*£¬ const char *sql£¬ sqlite3_callbacksql Óï·¨
£¬ void *£¬  char **errmsg );
Õâ¾ÍÊÇÖ´ÐÐÒ»Ìõ sql Óï¾äµÄº¯Êý¡£
µÚ1¸ö²ÎÊý²»ÔÙ˵ÁË£¬ÊÇÇ°Ãæopenº¯ÊýµÃµ½µÄÖ¸Õ롣˵ÁËÊǹؼüÊý¾Ý½á¹¹¡£
µÚ2¸ö²ÎÊýconst char ......

»ñÈ¡SQLServerµÄ×îÍêÕûÊý¾Ý×ÖµäµÄSQLÓï¾ä

Ô­´´ÓÚ2008Äê06ÔÂ18ÈÕ£¬2009Äê10ÔÂ18ÈÕÇ¨ÒÆÖÁ´Ë¡£
»ñÈ¡SQLServer
µÄ×îÍêÕûÊý¾Ý×ÖµäµÄSQL
Óï¾ä
 
ÆäÊµÍøÉÏÒѾ­Á÷´«ÁËºÜ¶à¹ØÓÚ»ñÈ¡
SQLServer
µÄÊý¾Ý×ÖµäµÄ°æ±¾£¬²»¹ýÎÒÏàÐÅÕâ¸öÓ¦¸ÃÊÇ×îÈ«µÄÁË£¬±¾Óï¾ä°üÀ¨ÁË±í¡¢×ֶΡ¢×Ö¶ÎÀàÐÍ¡¢×ֶγ¤¶È¡¢ÊÇ·ñΪ¿Õ¡¢ÊÇ·ñµÝÔö×ֶΡ¢Ë÷ÒýÃû³Æ¡¢Ë÷ÒýµÄ¶¨Î»¡¢Ë÷ÒýÀàÐÍ¡¢Ö÷¼ü¡¢Íâ¼üµ ......

Sql Serverͬ±íÄڵļ¶ÁªÅÅÐò

Sql Serverͬ±íÄڵļ¶ÁªÅÅÐò£¨¼´Í¬¸¸¼¶±ðµÄ×Ó½Úµã×ÔÐа´1~NÅÅÐò£©,2005°æ±¾ÒѾ­×Ô´øÁËROW_NUMBER() OVER×Ӿ䣬¿ÉÒԺܷ½±ãµØÊµÏÖЧ¹û¡£µ«ÊÇ2000°æ±¾²»Ö§³ÖÕâÖÖ×ö·¨£¬²»¹ýÒ²¿ÉÒÔ²ÉÈ¡ÌØÊâ×ö·¨
--slq2005
select rd.id,r.id ruleId,ROW_NUMBER() OVER(
    PARTITION BY r.id
    ORDER BY ......

¾«ÃîsqlÓï¾ä

1. ˵Ã÷£º¸´ÖƱí(Ö»¸´Öƽṹ£¬Ô´±íÃû£ºa£¬Ð±íÃû£ºb)
SQL: select * into b from a where 1<>1;
2. ˵Ã÷£º¿½±´±í(¿½±´Êý¾Ý£¬Ô´±íÃû£ºa£¬Ä¿±ê±íÃû£ºb)
SQL: insert into b(a, b, c) select d, e, f from b;
3. ˵Ã÷£ºÏÔʾÎÄÕ¡¢Ìá½»È˺Í×îºó»Ø¸´Ê±¼ä
SQL: select a.title, a.username, b.ad ......

ASP.NET´ÓSQL ServerÊý¾Ý¿âÌáȡͼƬ²¢ÏÔʾÔÚDataGrid

ʹÓÃGridview°ó¶¨Êý¾Ý¿âÖеÄͼƬ(×ªÔØ)
×¢£º´ËϵÁмǼÔÚÎÒʵ¼Ê¿ª·¢ÖÐÓöµ½µÄÎÊÌâºÍÊÕ²ØÒ»Ð©¼¼ÇÉÎÄÕ¡£
ÎÒÃǶ¼ÖªµÀ£¬ÔÚGridviewÖв»ÄÜÖ±½ÓÈ¥°ó¶¨Êý¾Ý¿âÖеÄͼƬ£¬ÎÒÃÇ¿ÉÒÔÀûÓÃHttpHandlerºÜÈÝÒ×µÄÍê³ÉÕâ¸öÈÎÎñ£¬ÔÚÕâÀïÎҼǼһÏÂÕâ¸ö¹ý³Ì¡£
1.ÉÏ´«Í¼Æ¬´æ´¢µ½Êý¾Ý¿âÖÐ
ÔÚÊý¾Ý¿âÖд´½¨Ò»¸ö±í£¬Ìí¼ÓÒ»ÏÂ3¸ö×ֶΣº
²½ÖèÒ»£ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ