ÔÚSQLÓï¾äÖнØÈ¡×Ö·û´®º¯ÊýµÄÓ¦ÓÃ
ÎÊÌâÒ»
ÓÐÕâÑùµÄÒ»¸öÎÊÌ⣬Êý¾Ý¿âÖÐÓÐÁ½¸ö±í£¬·Ö±ðÊÇGuest,Hotel£¬¼´ÂÿÍÐÅÏ¢±íºÍÂùÝÐÅÏ¢±í£¬Guest±íÖÐÓÐÒ»¸öÂÿͱàÂëµÄ×ֶΣ¬Õâ¸ö×ֶεÄÓÐ20룬ËüµÄǰ10λ´ú±íÕâ¸öÂÿÍËùסµÄÂùݣ¬ÏÖÔÚµÄÎÊÌâÊÇÒª¸ù¾ÝGuest±íÖеÄÂÿͱàÂë×Ö¶ÎÐÅÏ¢²éµ½ËûËùסµÄÂùݵÄÃû³ÆºÍÂùݵØÖ·£¡
ÎÊÌâ½â¾ö:
SQL SERVERµÄSQLÓï¾ä£ºselect Guest.ÂÿͱàÂë,Guest.ÂÿÍÐÕÃû,Hotel.ÂùÝÃû³Æ,Hotel.ÂùݵØÖ· from Guest,Hotel where Hotel.ÂùݱàÂë=SubString(Guest.ÂÿͱàÂë,1,10)
OracleµÄSQLÓï¾ä£ºselect Guest.ÂÿͱàÂë,Guest.ÂÿÍÐÕÃû,Hotel.ÂùÝÃû³Æ,Hotel.ÂùݵØÖ· from Guest,Hotel where Hotel.ÂùݱàÂë=SubStr(Guest.ÂÿͱàÂë,1,10)
ÎÊÌâ¶þ
A.½ØÈ¡´Ó×Ö·û´®×ó±ß¿ªÊ¼N¸ö×Ö·û
Declare @S1 varchar(100)
Select @S1='http://www.xrss.cn'
Select Left(@S1,4)
------------------------------------
ÏÔʾ½á¹û: http
B.½ØÈ¡´Ó×Ö·û´®Óұ߿ªÊ¼N¸ö×Ö·û(ÀýÈçÈ¡×Ö·ûwww.163.com)
Declare @S1 varchar(100)
Select @S1='http://www.xrss.cn'
Select right(@S1,11)
------------------------------------
ÏÔʾ½á¹û: www.163.com £¿£¿£¿£¿
C.½ØÈ¡×Ö·û´®ÖÐÈÎÒâλÖü°³¤¶È(ÀýÈçÈ¡×Ö·ûwww)
Declare @S1 varchar(100)
Select @S1='http://www.xrss.cn'
Select SUBSTRING(@S1,8,3)
------------------------------------
ÏÔʾ½á¹û: www.163.com
ÒÔÉÏÀý×Ó½ÔÊÇÒÑÖª½ØÈ¡Î»Öü°³¤¶È,ÏÂÃæ½éÉÜδ֪λÖõÄÀý×Ó
2.½ØÈ¡Î´ÖªÎ»Öõĺ¯Êý
&n
Ïà¹ØÎĵµ£º
ϵͳ»·¾³£ºWindows 7
Èí¼þ»·¾³£ºVisual C++ 2008 SP1 +SQL Server 2005
±¾´ÎÄ¿µÄ£º±àдһ¸öº½¿Õ¹ÜÀíϵͳ
ÕâÊÇÊý¾Ý¿â¿Î³ÌÉè¼ÆµÄ³É¹û£¬ËäÈ»³É¼¨²»¼Ñ£¬µ«ÊÇ×÷ΪÎÒÓÃVC++ ÒÔÀ´±àдµÄ×î´ó³ÌÐò»¹ÊÇ´«µ½ÍøÉÏ£¬ÒÔ¹©²Î¿¼¡£ÓÃVC++ ×öÊý¾Ý¿âÉè¼Æ²¢²»ÈÝÒ×£¬µ«Ò²²»ÊDz»¿ÉÄÜ¡£ÒÔÏÂÊÇÎҵijÌÐò½çÃæ£¬ºóÃæ ......
create table tb (ptoid int,proclassid int,proname varchar(10))
insert tb
select 1,1,'Ò·þ1'
union all
select 2,2,'Ò·þ2'
union all
select 3,3,'Ò·þ3'
union all
select 4,3,'Ò·þ4'
union all
select 5,2,'Ò·þ5'
union all
select 6,2,'Ò·þ6'
union all
select 7,2,'Ò·þ7'
union all
select 8 ......
/***************************************************
×÷Õߣºherowang(ÈÃÄãÍû¼ûÓ°×ÓµÄǽ£©
ÈÕÆÚ£º2010.1.5
×¢£º ×ªÔØÇë±£Áô´ËÐÅÏ¢
......
1 MySQLÖ§³Öenum,ºÍsetÀàÐÍ£¬SQL Server²»Ö§³Ö
¡¡¡¡2 MySQL²»Ö§³Önchar,nvarchar,ntextÀàÐÍ
¡¡¡¡3 MySQLµÄµÝÔöÓï¾äÊÇAUTO_INCREMENT£¬¶øMS SQLÊÇidentity(1,1)
¡¡¡¡4 MS SQLĬÈϵ½´¦±í´´½¨Óï¾äµÄĬÈÏÖµ±íʾÊÇ((0)),¶øÔÚMySQLÀïÃæÊDz»ÔÊÐí´øÁ½À¨ºÅµÄ
¡¡¡¡5 MySQLÐèҪΪ±íÖ¸¶¨´æ´¢ÀàÐÍ
¡ ......
˵µ½Èí½âÎö£¨soft prase
£©ºÍÓ²½âÎö£¨
hard prase
£©£¬¾Í²»Äܲ»ËµÒ»ÏÂ
Oracle
¶Ô
sql
µÄ´¦Àí¹ý³Ì¡£µ±Äã·¢³öÒ»Ìõ
sql
Óï¾ä½»¸¶
Oracle
£¬ÔÚÖ´ÐкͻñÈ¡½á¹ûǰ£¬
Oracle
¶Ô´Ë
sql
½«½øÐм¸¸ö²½ÖèµÄ´¦Àí¹ý³Ì£º
1¡¢Óï·¨¼ì²é£¨
syntax check
£©
&nb ......