sql server charindexºÍpatindexÏê½â
¼ÙÈçÄãд¹ýºÜ¶à³ÌÐò£¬Äã¿ÉÄÜż¶û»áÅöµ½ÒªÈ·¶¨×Ö·û»ò×Ö·û´Ü´®·ñ°üº¬ÔÚÒ»¶ÎÎÄ×ÖÖУ¬ÔÚÕâƪÎÄÕÂÖУ¬ÎÒ½«ÌÖÂÛʹÓÃCHARINDEXºÍPATINDEXº¯ÊýÀ´ËÑË÷ÎÄ×ÖÁкÍ×Ö·û´®¡£ÎÒ½«¸æËßÄãÕâÁ½¸öº¯ÊýÊÇÈçºÎÔËתµÄ£¬½âÊÍËûÃǵÄÇø±ð¡£Í¬Ê±ÌṩһЩÀý×Ó£¬Í¨¹ýÕâЩÀý×Ó£¬Äã¿ÉÒÔ¿ÉÒÔ¿¼ÂÇʹÓÃÕâÁ½¸öº¯ÊýÀ´½â¾öºÜ¶à²»Í¬µÄ×Ö·ûËÑË÷µÄÎÊÌâ¡£
CHARINDEXºÍPATINDEXº¯Êý³£³£ÓÃÀ´ÔÚÒ»¶Î×Ö·ûÖÐËÑË÷×Ö·û»òÕß×Ö·û´®¡£Èç¹û±»ËÑË÷µÄ×Ö·ûÖаüº¬ÓÐÒªËÑË÷µÄ×Ö·û£¬ÄÇôÕâÁ½¸öº¯Êý·µ»ØÒ»¸ö·ÇÁãµÄÕûÊý£¬Õâ¸öÕûÊýÊÇÒªËÑË÷µÄ×Ö·ûÔÚ±»ËÑË÷µÄ×Ö·ûÖеĿªÊ¼Î»Êý¡£PATINDEXº¯ÊýÖ§³ÖʹÓÃͨÅä·ûÀ´½øÐÐËÑË÷£¬È»¶øCHARINDEX²»Ö§³ÖͨÅå·û¡£½ÓÏÂÀ´£¬ÎÒÃÇÖð¸ö·ÖÎöÕâÁ½¸öº¯Êý¡£ ÄúËùä¯ÀÀµÄÎÄÕÂÀ´×Ô86oo.com
ÈçºÎʹÓÃCHARINDEXº¯Êý
www.86oo.com
CHARINDEXº¯Êý·µ»Ø×Ö·û»òÕß×Ö·û´®ÔÚÁíÒ»¸ö×Ö·û´®ÖеÄÆðʼλÖá£CHARINDEXº¯Êýµ÷Ó÷½·¨ÈçÏ£º
www.86oo.com
CHARINDEX ( expression1 , expression2 [ , start_location ] )
86oo.comÌṩ¸÷Àà½Ì³Ì
Expression1ÊÇÒªµ½expression2ÖÐÑ°ÕÒµÄ×Ö·ûÖУ¬start_locationÊÇCHARINDEXº¯Êý¿ªÊ¼ÔÚexpression2ÖÐÕÒexpression1µÄλÖá£
86oo¾«²Ê½Ì³Ì
CHARINDEXº¯Êý·µ»ØÒ»¸öÕûÊý£¬·µ»ØµÄÕûÊýÊÇÒªÕÒµÄ×Ö·û´®ÔÚ±»ÕÒµÄ×Ö·û´®ÖеÄλÖ᣼ÙÈçCHARINDEXûÓÐÕÒµ½ÒªÕÒµÄ×Ö·û´®£¬ÄÇôº¯ÊýÕûÊý“0”¡£ÈÃÎÒÃÇ¿´¿´ÏÂÃæµÄº¯ÊýÃüÁîÖ´ÐеĽá¹û£º 86oo.com»¶ÓÄã
CHARINDEX('SQL', 'Microsoft SQL Server') www.86oo.com
Õâ¸öº¯ÊýÃüÁ·µ»ØÔÚ“Microsoft SQL Server”ÖГSQL”µÄÆðʼλÖã¬ÔÚÕâ¸öÀý×ÓÖУ¬CHARINDEXº¯Êý½«·µ»Ø“S”ÔÚ“Microsoft SQL Server”ÖеÄλÖÃ11¡£
½ÓÏÂÀ´£¬ÎÒÃÇ¿´Õâ¸öCHARINDEXÃüÁ 86oo.com»¶ÓÄã
CHARINDEX('7.0', 'Microsoft SQL Server 2000') 86oo¾«²Ê½Ì³Ì
ÔÚÕâ¸öÀý×ÓÖУ¬CHARINDEX·µ»ØÁ㣬ÒòΪ×Ö·û´®“7.0” ²»ÄÜÔÚ“Microsoft SQL Server”Öб»ÕÒµ½¡£½ÓÏÂÀ´Í¨¹ýÁ½¸öÀý×ÓÀ´¿´¿´ÈçºÎ
Ïà¹ØÎĵµ£º
--´Ë´¦Ê¹ÓÃpubs¿â
declare @myname varchar(50)
declare @fname varchar(20)
declare @lname varchar(20)
declare my_cursor cursor for
select fname,lname from employee order by emp_id
open my_cursor
fetch next from my_cursor into @fname,@lname
while @@fetch_status=0
begin
set @ ......
org.jboss.util.NestedSQLException: Transaction TransactionImple < ac, BasicAction: -3f57fe61:e49:4ae01416:114 status: ActionStatus.ABORTED > cannot proceed STATUS_ROLLEDBACK; - nested throwable: (javax.transaction.RollbackException: Transaction TransactionImple < ac, BasicAction: -3f57fe61: ......
ÔÚÈ¡Ò»¸öƽ¾ùÖµµÄʱºòÍùÍùÓöµ½Ð¡ÊýµãλÊýµÄ½ØÈ¡¡£
Ç°¼¸ÌìÓöµ½¹ýÕâô¸öÎÊÌ⣬ÔÚKingDee EAS µÄ²éѯ·ÖÎöÆ÷ÀïÃæÈç¹ûÇóijһÎïÁϵÄƽ¾ùµ¥¼ÛʱÎÒÕâÑùдµÀ£º
select avg = case sum(bentry.FQuantity) when 0 then 0 else (sum(bentry.famount)/sum(bentry.FQuantity)) end,
´ËÓï¾ä¿´ËÆûʲôÎÊÌ⣬±Ï¾¹ÊÇÇóƽ¾ùÖµ£¬¿ÉÊÇÈç¹ûÒªÔ ......
·½·¨Ò»¡¢¾¡Á¿Ê¹Óø´ÔÓµÄSQLÀ´´úÌæ¼òµ¥µÄÒ»¶Ñ SQL.
ͬÑùµÄÊÂÎñ£¬Ò»¸ö¸´ÔÓµÄSQLÍê³ÉµÄЧÂʸßÓÚÒ»¶Ñ¼òµ¥SQLÍê³ÉµÄЧÂÊ¡£Óжà¸ö²éѯʱ£¬ÒªÉÆÓÚʹÓÃJOIN¡£
oRs=oConn.Execute("SELECT * from Books")
while not oRs.Eof
strSQL = "SELECT * from Authors WHERE AuthorID="&oRs("AuthorID") oRs2=oConn.Execute(strSQ ......
1¡¢ÎļþºÍÎļþ×éµÄº¬ÒåÓë¹Øϵ
ÿ¸öÊý¾Ý¿âÓÐÒ»¸öÖ÷Êý¾ÝÎļþ.ºÍÈô¸É¸ö´ÓÎļþ¡£ÎļþÊÇÊý¾Ý¿âµÄÎïÀíÌåÏÖ¡£ Îļþ×é¿ÉÒÔ°üÀ¨·Ö²¼ÔÚ¶à¸öÂß¼·ÖÇøµÄÎļþ£¬ÊµÏÖ¸ºÔØƽºâ¡£Îļþ×éÔÊÐí¶ÔÎļþ½øÐзÖ×飬ÒÔ±ãÓÚ¹ÜÀíºÍÊý¾ÝµÄ·ÖÅ䣯·ÅÖá£ÀýÈ磬¿ÉÒÔ·Ö±ðÔÚÈý¸öÓ²ÅÌÇý¶¯Æ÷ÉÏ´´½¨Èý¸öÎļþ£¨Data1.ndf¡¢Data2.ndf&nb ......