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

SQL ͨÅä·û

ÔÚËÑË÷Êý¾Ý¿âÖеÄÊý¾Ýʱ£¬SQL ͨÅä·û¿ÉÒÔÌæ´úÒ»¸ö»ò¶à¸ö×Ö·û¡£
SQL ͨÅä·û±ØÐëÓë LIKE ÔËËã·ûÒ»ÆðʹÓá£
ÔÚ SQL ÖУ¬¿ÉʹÓÃÒÔÏÂͨÅä·û£º
ͨÅä·ûÃèÊö
%
Ìæ´úÒ»¸ö»ò¶à¸ö×Ö·û
_
½öÌæ´úÒ»¸ö×Ö·û
[charlist]
×Ö·ûÁÐÖеÄÈκε¥Ò»×Ö·û
[^charlist]
»òÕß
[!charlist]
²»ÔÚ×Ö·ûÁÐÖеÄÈκε¥Ò»×Ö·û
ԭʼµÄ±í (ÓÃÔÚÀý×ÓÖеÄ)£º
Persons ±í:
IdLastNameFirstNameAddressCity
1
Adams
John
Oxford Street
London
2
Bush
George
Fifth Avenue
New York
3
Carter
Thomas
Changan Street
Beijing
ʹÓà % ͨÅä·û
Àý×Ó 1
ÏÖÔÚ£¬ÎÒÃÇÏ£Íû´ÓÉÏÃæµÄ "Persons" ±íÖÐÑ¡È¡¾ÓסÔÚÒÔ "Ne" ¿ªÊ¼µÄ³ÇÊÐÀïµÄÈË£º
ÎÒÃÇ¿ÉÒÔʹÓÃÏÂÃæµÄ SELECT Óï¾ä£º
SELECT * from Persons
WHERE City LIKE 'Ne%'
½á¹û¼¯£º
IdLastNameFirstNameAddressCity
2
Bush
George
Fifth Avenue
New York
Àý×Ó 2
½ÓÏÂÀ´£¬ÎÒÃÇÏ£Íû´Ó "Persons" ±íÖÐÑ¡È¡¾ÓסÔÚ°üº¬ "lond" µÄ³ÇÊÐÀïµÄÈË£º
ÎÒÃÇ¿ÉÒÔʹÓÃÏÂÃæµÄ SELECT Óï¾ä£º
SELECT * from Persons
WHERE City LIKE '%lond%'
½á¹û¼¯£º
IdLastNameFirstNameAddressCity
1
Adams
John
Oxford Street
London
ʹÓà _ ͨÅä·û
Àý×Ó 1
ÏÖÔÚ£¬ÎÒÃÇÏ£Íû´ÓÉÏÃæµÄ "Persons" ±íÖÐÑ¡È¡Ãû×ֵĵÚÒ»¸ö×Ö·ûÖ®ºóÊÇ "eorge" µÄÈË£º
ÎÒÃÇ¿ÉÒÔʹÓÃÏÂÃæµÄ SELECT Óï¾ä£º
SELECT * from Persons
WHERE FirstName LIKE '_eorge'
½á¹û¼¯£º
IdLastNameFirstNameAddressCity
2
Bush
George
Fifth Avenue
New York
Àý×Ó 2
½ÓÏÂÀ´£¬ÎÒÃÇÏ£Íû´Ó "Persons" ±íÖÐÑ¡È¡µÄÕâÌõ¼Ç¼µÄÐÕÊÏÒÔ "C" ¿ªÍ·£¬È»ºóÊÇÒ»¸öÈÎÒâ×Ö·û£¬È»ºóÊÇ "r"£¬È»ºóÊÇÈÎÒâ×Ö·û£¬È»ºóÊÇ "er"£º
ÎÒÃÇ¿ÉÒÔʹÓÃÏÂÃæµÄ SELECT Óï¾ä£º
SELECT * from Persons
WHERE LastName LIKE 'C_r_er'
½á¹û¼¯£º
IdLastNameFirstNameAddressCity
3
Carter
Thomas
Changan Street
Beijing
ʹÓà [charlist] ͨÅä·û
Àý×Ó 1
ÏÖÔÚ£¬ÎÒÃÇÏ£Íû´ÓÉÏÃæµÄ "Persons" ±íÖÐÑ¡È¡¾ÓסµÄ³ÇÊÐÒÔ "A" »ò "L" »ò "N" ¿ªÍ·µÄÈË£º
ÎÒÃÇ¿ÉÒÔʹÓÃÏÂÃæµÄ SELECT Óï¾ä£º
SELECT * from Persons
WHERE City LIKE '[ALN]%'
½á¹û¼¯£º
IdLastNameFirstNameAddressCity
1
Adams
John
Oxford Street
London
2
Bush
George
Fifth Avenue
New York
Àý×Ó 2
ÏÖÔÚ£¬ÎÒÃÇÏ£Íû´ÓÉÏÃæµÄ "Persons" ±íÖÐÑ¡È¡¾ÓסµÄ³ÇÊв»ÒÔ "A" »ò "L" »ò "N" ¿ªÍ·µÄÈË£º
ÎÒÃÇ¿ÉÒÔʹÓÃÏÂÃæµÄ S


Ïà¹ØÎĵµ£º

SQL ServerÖÐDATAADDºÍDATADIFFµÄÓ÷¨

ͨ³££¬ÄãÐèÒª»ñµÃµ±Ç°ÈÕÆںͼÆËãһЩÆäËûµÄÈÕÆÚ£¬ÀýÈ磬ÄãµÄ³ÌÐò¿ÉÄÜÐèÒªÅжÏÒ»¸öÔµĵÚÒ»Ìì»òÕß×îºóÒ»Ìì¡£´ó²¿·ÖÈË´ó¸Å¶¼ÖªµÀÔõÑù°ÑÈÕÆÚ½øÐзָÄê¡¢Ô¡¢Èյȣ©£¬È»ºó½ö½öÓ÷ָî³öÀ´µÄÄê¡¢Ô¡¢ÈյȷÅÔÚ¼¸¸öº¯ÊýÖмÆËã³ö×Ô¼ºËùÐèÒªµÄÈÕÆÚ£¡ÔÚÕâƪÎÄÕÂÀÎÒ½«½ÌÄãÈçºÎʹÓÃDATEADDºÍDATEDIFFº¯ÊýÀ´¼ÆËã³öÔÚÄãµÄ³ÌÐòÖпÉÄÜÄ ......

sqlÓï¾ä

/*»ñÈ¡Öظ´¼Ç¼ÖнÏСµÄÄǸöID*/ create table tmp_Repeat as  select  min(id) as id from poi group by idcode having count(*) >1; /*±¸·Ýɾ³ýµÄÊý¾Ý*/ select * from poi where id in (select id from tmp_repeat) /*ɾ³ýÖظ´¼Ç¼ÖÐID½ÏСµÄÄÇÌõ
select replace('°¢¹ðÊǸöºÃº¢×Ó','°¢¹ð','СÏÍ') from du ......

ÓÃSQLÈ¥³ý±íÖÐijÁеÄIdentiferÊôÐÔ

sp_configure 'allow updates', 1
GO
reconfigure with override
GO
update syscolumns set colstat = colstat & 0x0000
where id=object_id('±íÃû') and name='ÁÐÃû'
GO
sp_configure 'allow updates', 0  ......

SQL Server 2008ÐÂÌØÐÔ£º¸ü¸Ä¸ú×Ù

ÔÚ´óÐ͵ÄÊý¾Ý¿âÓ¦ÓÃÖУ¬¾­³£»áÓöµ½²¿·ÖÊý¾ÝµÄÍÑ»úºÍ¶à¸öÊý¾Ý¿âµÄºÏ²¢ÎÊÌâ¡£±ÈÈçÏÖÔÚÓÐÒ»¸öÈ«Ê¡·¶Î§Ê¹ÓõÄÓ¦ÓóÌÐò£¬Ã¿¸öÊж¼²¿ÊðÁ˵¥¶ÀµÄÏàͬµÄÓ¦ÓóÌÐò·þÎñÆ÷ºÍÊý¾Ý¿â·þÎñÆ÷£¬Ã¿¸öÔÂÐèÒª½«È«Ê¡ËùÓÐÊеÄÊý¾ÝÈ«²¿»ã×ÜÆðÀ´ÓÃÓÚ³öÈ«Ê¡µÄ±¨±í£¬ÕâÊÇÒ»Öֺܳ£¼ûµÄÊý¾Ý¿âºÏ²¢ÎÊÌâ¡£ÔÙ±ÈÈçÎÒÃÇ×öÁËÒ»¸öSmartClientµÄÓ¦ÓóÌÐò£¬Ã¿¸ö¿ ......

SQLµ÷ÓÅ(Á¬½Ó·½Ê½)

SQLµ÷ÓÅ Ö® Á¬½Ó·½Ê½
JoinÊÇÒ»ÖÖÊÔͼ½«Á½¸ö±í½áºÏÔÚÒ»ÆðµÄν´Ê£¬Ò»´ÎÖ»ÄÜÁ¬½Ó2¸ö±í£¬±íÁ¬½ÓÒ²¿ÉÒÔ±»³ÆΪ±í¹ØÁª¡£ÔÚºóÃæµÄÐðÊöÖУ¬Ê¹ÓÔrow source”À´´úÌ攱픣¬ÒòΪʹÓÃrow source¸üÑϽ÷һЩ£¬²¢ÇÒ½«²ÎÓëÁ¬½ÓµÄ2¸örow source·Ö±ð³ÆΪrow source1ºÍrow source 2¡£Join¹ý³ÌµÄ¸÷¸ö²½Öè¾­³£ÊÇ´®ÐвÙ×÷ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ