Very odd problem. This function has randomly started hanging and timing out when I call it like this:
DECLARE @persId int
SET @persId = 336
SELECT * FROM [CIDER].[dbo].[SMAN_ACL_getPermissions] (
null
,@persId
,1
,null)
GO
But returns super quick when I call it like this:
SELECT * FROM [CIDER].[dbo].[SMAN_ACL_getPermissions] (
null
,336
,1
,null)
GO
Could someone please highlight the difference between these two me? It’s making debugging very hard…
The variable could be a null value, whereas the static value definitely is not. This can lead to different execution plans.