日期:2014-05-18  浏览次数:20469 次

with nolock的问题
select t.hi,t.mob,t.hed,t.timefrom ( select convert(varchar(10),convert(int,(convert(float,lon)*10)))+ convert(varchar(10),convert(int,(convert(float,lat)*10))) lonlat, lon,lat,dir,spe,mob,gpstime from Tableabc where time between '2012-7-12 15:04:04' and '2012-7-13 17:04:04' and convert(float,lat)!=0 and convert(float,lon)!=0 ) t left join tabletemp o on t.lonlat=o.lonlat order by t.time 

想在这个sql上加with nolock该如何加

------解决方案--------------------
SQL code

--你的语句本身有问题,要想加,加在表后就可以了,如
select * from a with (nolock)
inner join b with (nolock) on a.id=b.id;

------解决方案--------------------
表名称后面加就可以了
------解决方案--------------------
select t.hi,t.mob,t.hed,t.timefrom ( select convert(varchar(10),convert(int,(convert(float,lon)*10)))+ convert(varchar(10),convert(int,(convert(float,lat)*10))) lonlat, lon,lat,dir,spe,mob,gpstime from Tableabc where time between '2012-7-12 15:04:04' and '2012-7-13 17:04:04' and convert(float,lat)!=0 and convert(float,lon)!=0 ) t with (nolock)left join tabletemp o with (nolock) on t.lonlat=o.lonlat order by t.time


可以资源占用释放
------解决方案--------------------
连接表的后边可以with nolock
------解决方案--------------------
表名后面直接跟,如果有别名,跟在别名后