Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB
ÈÈÃűêÇ©£º c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 ×îÐÂÎÄÕ : sql

SQL ÐÐÁл¥±äÖ®ÖÕ¼«·½·¨

SQLÖ®ÐÐÁл¥±äÎÊÌâ¡£
     Ñ°Ñ°ÃÙÃÙ£¬SQLÐбäÁУ¬ÁбäÐÐÎÊÌâËäÈ»½â¾ö·½°¸Öڶ࣬µ«ÎÞ²»´æÔÚ×Å´úÂ븴ÔÓ£¬ÐÔÄÜÇ·¼ÑµÈÎÊÌâ¡£½ñÓÐÐÒµÃÖª×î¼Ñ½â¾ö·½°¸£¬ºÃ¶«Î÷²»¸Ò¶ÀÏí£¬±Ê¼ÇÖ®£¬ÑÅË×¹²ÉÍ¡£
     ʾÀýÊý¾Ý£º£¨¸ÃʾÀýÊý¾ÝÀ´×ÔYHHRÊý¾Ý¿â Performance_Zmonth_Value±í£©
Employee_Id   Zmonth   Performance_Cd    Value      
10001         200806    A                 2.00     
10001         200806    B                 2.00      
10001         200806    C                 2.00   &nbs ......

sql×¢ÈëÍ»Æƹؼü×Ö¹ýÂË


Ò»Ö±ÒÔÀ´¶¼ÒÔΪֻÓпոñ£¬tab¼üºÍ×¢ÊÍ·û/**/¿ÉÒÔÓÃÀ´Çиîsql¹Ø¼ü×Ö£¬¶Îʱ¼ä
ÔÚа°Ë¿´ÁË·çѸcms×¢È멶´ÄÇƪÌû×Ó£¬²ÅÖªµÀÔ­À´»Ø³µÒ²¿ÉÒÔÓÃÀ´×÷Ϊ·Ö¸î·û£¨
ÒÔÇ°¾¹È»Ã»ÓÐÏëµ½£¬ÕæÊÇʧ°Ü£©¡£»Ø³µµÄasciiÂëÊÇchr(13)&chr(10)£¬ÖÁÓÚΪʲ
ôҪÁ½¸öÁ¬ÔÚÒ»Æð£¬Õâ¸öÎÒÒ²²»ÖªµÀ¡£×ª»»³Éurl±àÂëÐÎʽÊÇ%0d%0a£¬ÓÚÊǾͿÉÒÔ
ÓÃ%0d%0a´úÌæ¿Õ¸ñpassһЩ¹ýÂË¿Õ¸ñµÄ¼ì²éÁË¡£
ÒýÉêһϣ¬Ö»ÓÃ%0dÄÜÕý³£Ö´ÐÐÓï¾äÂð£¿Ö»ÓÃ%0aÄØ£¿²âÊÔÖ¤Ã÷£¬ÓÃÈÎÒâÒ»ÖÖ·Ö¸î
ÔÚmssql¡¢mysqlºÍaccessÀïÃ涼ÊÇ¿ÉÒԵġ£
ÁíÍ⣬¹ØÓÚmssqlµÄ¶àÓï¾äÎÊÌâ¡£ÎÒÒÔÇ°Ò»Ö±ÒÔΪ±ØÐëÓ÷ֺÅ×÷ΪÓï¾äµÄ½á⣬ºó
À´·¢ÏÖ£¬ÍêÈ«²»ÊÇÄÇÑù¡£ÀàËÆ
Copy code
select * from table exec xp_cmdshell'xxxxxxxxxx'
select * from table/**/exec xp_cmdshell'xxxxxxxxxx'
select * from table|---tab---|exec xp_cmdshell'xxxxxxxxxx'
select * from table|---enter---|exec xp_cmdshell'xxxxxxxxxx'
µÄÓï¾ä¶¼ÊÇ¿ÉÒÔÕý³£Ö´Ðеġ£¶øÎÒÒÔÇ°¾¹È»Ò»Ö±²»ÖªµÀ£¡²»¹ýÕâ¸öòËƸúÁ¬½ÓÊý
¾Ý¿âÇý¶¯ÓйØϵ£¬odbc¿ÉÒÔÕý³£Ö´ÐУ¬sqloledbµÄ»°¾Í»á±¨´í¡£ÓÐÐËȤµÄ¼ÌÐøÑÐ
¾¿°É
ÕâÑù£¬ÒÔºóÓöµ½´ø¿Õ¸ñ¹ýÂ˹ؼü×ÖµÄÀ¹½Ø³ÌÐò£¬ÓÖ¿ÉÒÔ·¢»Ó· ......

sqlÈÕÆÚ¸ñʽ»¯

SQLÈÕÆÚ¸ñʽ»¯
 
  0   »ò   100   (*)     ĬÈÏÖµ   mon   dd   yyyy   hh:miAM£¨»ò   PM£©    
  1   101   ÃÀ¹ú   mm/dd/yyyy    
  2   102   ANSI   yy.mm.dd    
  3   103   Ó¢¹ú/·¨¹ú   dd/mm/yy    
  4   104   µÂ¹ú   dd.mm.yy    
  5   105   Òâ´óÀû   dd-mm-yy    
  6   106   -   dd   mon   yy    
  7   107   -   mon   dd,   yy    
  8   108   -   hh:mm:ss    
  -&nbs ......

ÖØдSQL Server DateDiffº¯Êý

--½«ÏµÍ³datediffº¯ÊýÖØд£¬Ö÷Òª°ÑdatepartÀàÐ͸ÄΪvarhcar£¬·½±ãµ÷ÓÃ
--×÷Õß:°½Ê¿Î°
--Date:2009-10-14 10:29
create function MyDateDiff(@datepart varchar(50), --ÈÕÆÚ¼ä¸ôÀàÐÍ:year,month,day.etc
@date1 varchar(50), @date2 varchar(50))
returns int
as
begin
 declare @part int
 if @datepart='year'
  begin
   set @part=datediff(year,@date1,@date2)
  end
 if @datepart='month'
  begin
   set @part=datediff(month,@date1,@date2)
  end
 if @datepart='day'
  begin
   set @part=datediff(day,@date1,@date2)
  end
 if @datepart='week'
  begin
   set @part=datediff(week,@date1,@date2)
  end
 if @datepart='hour'
  begin
   set @part=datediff(hour,@date1,@date2)
  end
 if @datepart='minute'
  begin
   set @part=datediff(minute,@date1,@date2)
  ......

SQL´æ´¢¹ý³Ì²âÊÔ£¨4£©——´´½¨T

ÎÊÌâ
      ÈçºÎ´´½¨Ò»¸öT-SQL²âÊÔÌ×¼þÓÃÓÚ²âÊÔSQL´æ´¢¹ý³Ì¡£
Éè¼Æ
      Ê×ÎÞ£¬Í¨¹ý²åÈë´óÁ¿²âÊÔƽ̨Êý¾Ý×¼±¸ºÃÒ»¸ö°üº¬´ý²â´æ´¢¹ý³ÌµÄµ×²ãÊý¾Ý¿â¡£½ÓÏÂÀ´£¬Ê¹ÓÃÒ»¸öSQLÓαê(cursor)±éÀúÕâ¸ö²âÊÔÓÃÀýÊý¾Ý±í¡£Õë¶Ôÿ¸ö²âÊÔÓÃÀý£¬µ÷Óôý²â´æ´¢¹ý³Ì²¢ÇÒÈ¡µÃËüµÄ·µ»ØÖµ£¬°Ñʵ¼Ê·µ»ØÖµÓëÆÚÍûÖµ½øÐбȽϣ¬´Ó¶øÅж¨²âÊÔ½á¹ûÊÇͨ¹ýÓë·ñ£¬È»ºóÏÔʾ»ò±£´æ²âÊÔ½á¹û¡£
·½°¸
——testAuto.sql
——ΪdbEmployeesÌî³äÊý¾Ý
truncate table dbEmployees.dbo.tblEmployees
insert into dbEmployees.dbo.tblEmployees values('e11','Adams','15/10/2009')
insert into dbEmployees.dbo.tblEmployees values('e22','Baker','15/10/2009')
insert into dbEmployees.dbo.tblEmployees values('e33','Young','15/10/2009')
insert into dbEmployees.dbo.tblEmployees values('e44','Zetta','15/10/2009')
——´Ë´¦²åÈë¸ü¶àÊý¾Ý
declare tCursor cursor fast_forward
    for select caseID,input,expected
    from dbTestCasesAndResults.dbo.tblTestCases
  ......

Ò»¸öʵÏÖÁ˺ÍÊý¾Ý¿â´ò½»µÀµÄÔ´Îļþ£¨×é×°sqlÓï¾ä°æ£©

package com.itcast.service.base;
import java.util.LinkedHashMap;
import javax.persistence.Entity;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.itcast.util.QueryResult;
/**
 * Õë¶ÔËùÓÐʵÌåbeanµÄÒ»¸ö³éÏóÀ࣬ËùÓеÄʵÌåbean°üÀ¨ProductType,ProductµÈµÈ
 * @author lucky
 *
 */
@Transactional
public abstract class DaoSupport implements DAO {
 
 @PersistenceContext protected EntityManager em;
 
 //µ÷ÓÃÏÂÃæµÄpublic <T> void delete(Class<T> entityClass,Object[] entityids·½·¨
 public <T> void delete(Class<T> entityClass,Object entityid) {
  delete(entityClass,new Object[]{entityid});
 }
 public <T> void delete(Class<T> entityClass,Object[] entityids) {
  for ......
×ܼǼÊý:4346; ×ÜÒ³Êý:725; ÿҳ6 Ìõ; Ê×Ò³ ÉÏÒ»Ò³ [684] [685] [686] [687] 688 [689] [690] [691] [692] [693]  ÏÂÒ»Ò³ βҳ
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ