 	;WITH Tasks AS (
 		SELECT TOP 1 FfmpegTasks.Id, Arguments, TaskState, Started, Heartbeat, HeartbeatMachineName, Progress, DestinationFilename, Jobs.id AS FfmpegJobs_Id
 		FROM FfmpegTasks
-		INNER JOIN ffmpegfarm.dbo.FfmpegJobs Jobs ON FfmpegTasks.FfmpegJobs_id = Jobs.id
+		INNER JOIN FfmpegJobs Jobs ON FfmpegTasks.FfmpegJobs_id = Jobs.id
 		WHERE TaskState = @QueuedState OR (TaskState = @InProgressState AND HeartBeat < @Timeout)
 		ORDER BY Jobs.Needed ASC, Jobs.Id ASC
 	)



GO
GRANT EXECUTE ON [dbo].[sp_InsertClientHeartbeat] TO [ffmpegfarm] AS [dbo]
GO
/****** Object:  Table [dbo].[Clients]    Script Date: 17-10-2016 13:13:20 ******/
SET ANSI_NULLS ON

/****** Object:  StoredProcedure [dbo].[sp_GetNextTask]    Script Date: 17-10-2016 13:13:20 ******/
SET ANSI_NULLS ON
GO
