I have a simple temp table declared as a table variable. This is used on nearly 50 deployed databases and works fin. However, on one server, 2008-R2 as are all the others, the Insert statement hangs. If I change to a #temptable the exact same code works. Is there a configuration setting that would account for this behavior. This is what the code looks like;
On all my other servers this works fine. On one server it would hang until I modified it to use CREATE table #Counts.
declare @Counts table ( CountOf varchar(10), StatusID bigint, StatusName varchar(30), TheCount bigint ) insert into @Counts Select 'Files' as CountOf, sc.StatusID as StatusID, sc.StatusName as StatusName, count_big(*) as TheCount from dfFiles f with (nolock) join dfFolders d with (nolock) on d.folderid = f.folderid join dfVolumes v with (nolock) on v.VolumeUID = d.VolumeUID and v.MachineName = @MachineName join dfStatusCodes sc with (nolock) on sc.StatusID = f.StatusID group by sc.StatusID, sc.StatusName union all Select 'Folders' as CountOf, sc.StatusID as StatusID, sc.StatusName as StatusName, count_big(*) as TheCount from dfFolders d with (nolock) join dfVolumes v with (nolock) on v.VolumeUID = d.VolumeUID and v.MachineName = @MachineName join dfStatusCodes sc with (nolock) on sc.StatusID = d.StatusID group by sc.StatusID, sc.StatusName