SQL code: select *,cast(bin as decimal(10,2)) as bin2 into #tmp2 from MyTable where convert(varchar(10),[Time],120) between '2009-07-01' and '2009-10-28 23:59:59' order by bin2
2.°´ÕÕÎÒºóÃæÒ»Á¬´®µÄÃãÇ¿ÍÆ²â£¬Ã²ËƲåÈëµ½#tmp2±íµÄÊý¾Ý¸ù±¾Ã»Óо¹ýorder by bin2ÅÅÐò£¬¸ü²»ÖªÓÐûÓо¹ýwhereµÄÌõ¼þɸѡ£¬£¬£¬£¬£¬£¬£¬¼ÙÈôÈçÎÒÍÆ²âµÄ»°£¬Óзñ½â¾ö°ì·¨£¿o select * from #tmp2
? print exec() up SQL code: create table #tt ( ID int identity(1,1) primary key, Bin varchar(10) ) insert into #tt select 'aa' insert into #tt select 'bb' insert into #tt select 'cc'
exec ('select * from #tt') ID Bin ----------- ---------- 1 aa 2 bb 3 cc
´ó¼ÒºÃ£¬ÇëÎÊÔÚ±íMÖÐÓÐ×ֶΣºa b c d e ÎÒÏë²é³öÆäÖÐÂú×ãÏÂÃæÈÎÒâÒ»ÏîµÄÊý¾Ý£¬1.×Ö¶Îa µÄÖµ²»ÊÇ ¡®Êé»ò±Ê»ò±¾¡¯ÖÐÈÎÒ»£¬2.aΪÊéµÄʱºò×Ö¶Îb,cÊÇ¿Õ;3.µ±aֵΪ±ÊµÄʱºòdÊÇ¿Õ;4.µ±aΪ±¾µÄʱºòb,d,e¶¼ÊÇ¿Õ;5.È ......