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

sql inÎÊÌâ

listidÊÇintÊý¾Ý
declare @listid nvarchar(100)
set @listid='(1,2,3,7,9,10)'
select * from forums where listid in(@listid)ʱÌáʾÈçÏ´íÎó£º
ÔÚ½« nvarchar Öµ '(1,2,3,7,9,10)' ת»»³ÉÊý¾ÝÀàÐÍ int ʱʧ°Ü¡£

µ«
declare @sql nvarchar(200)
declare @listid nvarchar(100)
set @listid='(1,2,3,7,9,10)'
set @sql='select * from forums where listid in(' + @listid + ')'
exec(@sql)
¾Í²»»áÓÐ´í¡£

listidÊÇintÊý¾Ý
declare @listid nvarchar(100)
set @listid='(1,2,3,7,9,10)'
select * from forums where listid in(@listid)ʱÌáʾÈçÏ´íÎó£º
ÔÚ½« nvarchar Öµ '(1,2,3,7,9,10)' ת»»³ÉÊý¾ÝÀàÐÍ int ʱʧ°Ü¡£

µ±È»À²,Õâ¸ö»áĬÈÏת³ÉLISTIDÀàÐÍ,ת²»¹ý¾Í±¨´íÁË,
ÓÃCHARINDEX»ò¶¯Ì¬EXEC

charindexÎÒÊÔ¹ý£¬µ«µ±@listid='12'ʱ
»á°Ñlistid=1,2,12µÄ¶¼»áÁгöÀ´

SQL code:
--TRY
select * from forums where charindex(','+ltrim(listid)+',',','+@listid+',')


ÒýÓÃ
charindexÎÒÊÔ¹ý£¬µ«µ±@listid='12'ʱ
»á°Ñlistid=1,2,12µÄ¶¼»áÁгöÀ´

CHARINDEX(','+LISTID+',',','+@LISTID+',')>0

ÒýÓÃ
SQL code--TRYselect*from forumswherecharindex('


Ïà¹ØÎÊ´ð£º

SQLÓï¾äÕýÈ·µ«ÊÇRESULTSETÖÐûÓÐÖµ

StringBuffer str = new StringBuffer("select * from menu where parentid=1 and mid <>1 order by parentid");

List list = new ArrayList();
ResultSet rst = null;
DataBa ......

Çë½Ìoracleµ¼³öµ½sql server2005

û¸É¹ýÕâÊ£¬Ò²²»ÖªµÀoracleÊý¾Ý¿âɶÑù£¬Çë½Ì´óϺÃǾßÌå²½ÖèÊÇʲô£¿ÐèҪעÒâЩʲô£¿
ÊÇÕû¸ö¿âµÄÊý¾Ý»¹ÊÇ±íµ¥?

Õæ¸öÊý¾Ý¿â

Õû¸öÊý¾Ý¿â£¬ÁíÍâÎÒÊÇ´Óһ̨װÓÐoracleµÄµçÄÔµ¼Èëµ½Áíһ̨װÓÐsql serverµÄµçÄÔÖС ......

Çó½ÌÒ»¸öSql²éѯÎÊÌâ¡£

ÓÐÈý¸ö±íÒ»¸öÊDzɹºµ¥¸ñʽÈçÏÂ
Èë¿âµ¥±í£º

Èë¿âµ¥ºÅ      ²úÆ·        Öʼì±àºÅ      Èë¿âÊýÁ¿
001          Æ·ÖÖ1&n ......

Çë½Ìsql¸ßÊÖ,¹ØÓÚms-sqlserverËø»úÖÆ

SQL code:

declare @cnt int
select @cnt=count(1) from TableTest
if(@cnt==0)
insert into TableTest values(1,'abc')


¶ÔÓÚÕâÑùµÄÒ»¶Îsql²¢·¢Ö´ÐÐʱ,Ó¦¸ÃÓпÉÄܲåÈëÖØ¸´¼Ç¼
²»ÖªµÀ´ó¼ÒÊÇÔõô· ......

sql 2005 ±ê×¼°æÊÇ·ñ¿ÉÒÔÔ¶³ÌÁ¬½Ó

ÇëÎʸßÊÖ2005µÄ±ê×¼°æÊÇ·ñ¿ÉÒÔÔ¶³ÌÁ¬½Ó£¬Èç¹û¿ÉÒÔ£¬Ó¦¸ÃÔõôÉèÖã¬ÎÒ°´ÕÕ Express°æµÄÉèÖÃÁË£¬²»ÐС£¡£
¿ÉÒÔ

¿ÉÒÔ

²»ÖªµÀÄãÏëÔõôԶ³ÌÁ´½Ó

Ö±½ÓÔÚ¿Í»§¶ËµÇ¼¡£¡£


°´ÕÕ5Â¥µÄ×öÁË È»ºóÔÚ¿Í»§¶ËдÁ¬½Ó× ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ