´Ó¸÷ÖÖλÖýØÈ¡×Ö·û´®µÄSQLÓï·¨
Öª: ×Ö¶ÎA='F:\photo\Winter Leaves.jpg'
ÒªÇó:·Ö¶Î½Øȡÿ¶Î×Ö·û[×Ö¶ÎA²»ÄÜΪTEXTÀàÐÍ,·ñÔò±¨´í]
½â¾ö·½·¨:
---½ØÈ¡×Ö·û´®AµÄµÚÒ»¸ö\×ó±ßµÄ×Ö·û´®
select left(A,charindex('/',A)-1)
Êä³ö½á¹û£ºF:
---½ØÈ¡\ÖмäµÄ×Ö·û´®
select left(stuff(A,1,charindex('/',A),''),charindex('/',stuff(A,1,charindex('/',A),''))-1)
Êä³ö½á¹û£ºphoto
---½ØÈ¡×îºóÒ»¸ö\ºóÃæµÄ×Ö·û´®
select reverse(left(reverse(A),charindex('/',reverse(A))-1))
Êä³ö½á¹û£ºWinter Leaves.jpg
---½ØÈ¡×Ö·û´®AµÄÊ××ÖÄ»
select STUFF(A,1, 1, '')
Êä³ö½á¹û£º:\photo\Winter Leaves.jpg
Ïà¹ØÎĵµ£º
±¾ÕÂÊǹØÓÚ²éѯ¡£ÕâÊÇÒ»¸öÖ÷Ì⣬ÔÚºËÐĵĿͻ§/·þÎñÆ÷±à³Ì£¬Òò´ËÕâÊDZ¾Êé¸üÖØÒªµÄƪÕÂÖ®Ò»¡£
¸Ã²ÄÁϽ«±»·Ö³ÉÒÔÏÂÖ÷Òª²¿·Ö£º
ʹÓÃTQuery¶ÔÏó
ʹÓñ¾µØºÍÔ¶³Ì·þÎñÆ÷µÄSQLÀ´Ñ¡Ôñ£¬¸üУ¬É¾³ýºÍ²åÈë¼Ç¼
ʹÓÃSQLÓï¾äÀ´´´½¨Á¬½Ó£¬ÁªÏµÓαêºÍ³ÌÐò£¬ËÑË÷µ¥¸ö¼Ç¼
Õâ¸öËõд´ú±íµÄSQL½á¹¹»¯²éѯÓïÑÔ£¬Í¨³£ÊÇÃ÷ÏÔµÄÐø¼¯»ò˵à ......
ÕªÒª
¶ÔÓÚSQL ServerÖеÄÔ¼Êø£¬Ïë±Ø´ó¼Ò²¢²»ÊǺÜÄ°Éú¡£µ«ÊÇÔ¼ÊøÖÐÕæÕýµÄÄÚºÊÇʲô£¬²¢²»ÊǺܶàÈ˶¼ºÜÇå³þµÄ¡£±¾ÎÄÒÔÏêϸµÄÎÄ×ÖÀ´½éÉÜÁËʲôÊÇÔ¼Êø£¬ÒÔ¼°ÈçºÎÔÚÊý¾Ý¿â±à³ÌÖÐÓ¦ÓúÍʹÓÃÕâЩԼÊø£¬À´´ïµ½¸üºÃµÄ±à³ÌЧ¹û¡££¨±¾ÎIJ¿·ÖÄÚÈݲο¼ÁËSQL ServerÁª»úÊֲᣩ
ÄÚÈÝ
Êý¾ÝÍêÕûÐÔ·ÖÀà
ʵÌåÍêÕûÐÔ
&nb ......
//È¡³öÔ´Êý¾Ý
select groupname,totalnum,inputdate,groupid into #temp from
(select count(*)as totalnum,p.groupid,g.groupname,convert(nvarchar(10),inputdate,120) as 'inputdate'
from person p left join admin_group g on p.groupid = g.groupid and deleteflag = '0'
where p.inactive=' ......
ÎÒÃÇÔÚ×öºÜ¶àÏîĿʱ¶¼ÒªÉæ¼°µ½Êý¾Ý¿â£¬ÌرðÊÇһЩ±È½Ï´óÐ͵ÄwebÏîÄ¿£¬¸üÊÇÓнϴóµÄ²¢·¢´¦Àí£¬ËùÒÔ¶ÔÊý¾Ý¿âµÄ²Ù×÷ÓпÉÄÜ»á²úÉúËÀËø£¬¶ÔÓÚÊý¾Ý¿âµÄËÀËø£¬Ò»°ãÊý¾Ý¿âϵͳ¶¼»áÓÐÒ»Ì×»úÖÆÈ¥½âËø£¬Ò»°ã²»»áÔì³ÉÊý¾Ý¿âµÄ̱»¾£¬µ«½âËøµÄ¹ý³Ì»áÔì³ÉÊý¾Ý¿âÐÔÄܵļ±ËÙϽµ£¬·´Ó³µ½³ÌÐòÉϾͻáÔì³É³ÌÐòµÄ·´Ó¦ÐÔÄܵÄϽµ£¬²¢ ......
SQL Server ¼¸¸öºÃÓõÄSQLÓï¾ä
1¡¢¸´ÖƱí
select * into desttable from srctable
½« srctable ÍêÕûµØ¸´ÖÆÒ»·Ýµ½ desttable ÖУ¬µ±È»ºóÃæÒ²¿ÉÒÔ¼ÓÉÏÌõ¼þÀ´ÏÞ¶¨ÐèÒª¸´ÖƵļǼ
ÒªÇó£ºdesttable ±ØÐëΪ²»´æÔڵıíÃû¡£
insert into desttable(column1, column2) select columna, columnb from sr ......