select * from Tab where ID in (3,1,8,6,9,2)
ÕâÑùËѳöÀ´µÄ¼Ç¼ Êǰ´ID´ÓСµ½´óÅÅÁеÄ
Èç
1 ...
2 ...
3 ...
6 ...
8 ...
9 ...
µ«ÊÇÎÒÏë¾Í°´ÕÕ 3,1,8,6,9,2Õâ¸ö˳ÐòÅÅÁÐ
ÇëÎʸ÷λ´óÏÀÒªÔõôдÕâ¸ösql
¶øÇÒÊÇÓиö²ÎÊý @ID='3,1,8,6,9,2' ´«²Î½øÀ´µÄ
SQL code:
--(1)½èÓÃ×Ö·û´®½øÐÐÎÞ¹æÂÉÅÅÐò
create table #DepartMent
(
Depart varchar(10)
)
insert into #DepartMent select '×鳤'
union all select 'ÖúÀí'
union all select '×ܾÀí'
union all select 'Ô±¹¤'
union all select '¸±×ܾÀí'
union all select 'Ö÷¹Ü'
declare @sql varchar(100)
set @sql=N'×ܾÀí,¸±×ܾÀí,Ö÷¹Ü,×鳤,ÖúÀí,Ô±¹¤'
select * from #DepartMent
order by charindex(N','+Depart+N',',N','+@sql+N',')
±¾ÎÄÀ´×ÔCSDN²©¿Í£¬×ªÔØÇë±êÃ÷³ö´¦£ºhttp://blog.csdn.net/ws_hgo/archive/2009/02/06/3866925.aspx
±¾ÎÄÀ´×ÔCSDN²©¿Í£¬×ªÔØÇë±êÃ÷³ö´¦£ºhttp://blog.csdn.net/ws_hgo/archive/2009/02/06/3866925.aspx
SQL code:
select * from Tab where ID in (3,1,8,6,9,2)
order by charindex(','+rtrim(ltrim(ID))+',',','+'3,1,8,6,9,2'+',')
SQL code
Code highlighting produced by Actipro CodeHighlighter (freeware)
http:
select convert(varchar(50),cast(convert(numeric(18,2),1275674000000/100000000)as real))+'ÒÚ'
select cast(convert(numeric(18,2),1275674000000/100000000)as real)
ΪʲôÉÏÒ»¸öÓÃvarcharת»»ºó¾ÍÖ»±£ÁôÁËÒ ......
sqlserver2005 ½¨Á¢µÄÊý¾Ý¿â£¬ÓëÊÖ³Öpda´«ÊäÊý¾Ý£¬×î½üͻȻ³öÏÖÎÞ·¨´«µÝÊý¾ÝµÄÎÊÌ⣬pda¶ËÌáʾµÄ´íÎóʱoutofmemoryexception£¬µ«ÊÇpdaÉÏÃæµÄÈÝÁ¿Ã»ÓÐÎÊÌ⣬
sqlserverµÄÈÕ×ÓÉϵĴíÎóÈçÏ£º
ÈÕÆÚ 2010-1-25 14:45: ......