At least now you can send them a link to this and ask them to let you know if they have any questions.
If others canât replicate it, but you can replicate it, I imagine sending them your DB might be able to let them get the same issue?
You need to isolate when the problem is happening. Something specific about your version or database, or EDMXâŚ
I could see a Database Regen trying to create it or maybe on App Pool Start⌠but other then that Would be interesting if you can find the BAQ and others can try it.
i cannot imagine why would any BAQ do it. So do not limit on BAQ.
I could see that EDMX checks DB for that function, and for some reason thinks it is different then it needs to be and recreates it. But what can cause it, no idea.
Jose does use Multiple App Servers and if you Regen on 1 and you dont recycle all of them your edmx may be different. Maybe one App Server edmx is out of sync and it treats it as âI should re-initializeâ.
I always have to Regen Database and then Recycle all my App Servers for the .dll to update.
We recycle all of them when we regen. Part of our standard process.
After further looking at it we realized is erp.listEntry which isnât called from a BAQ (baq uses Ice.Entry) so @Olga is right this isnât necessarily a BAQ issue.
It appears that for some reason like she said the EDMX determines it needs to create (or re-create) that function⌠But why?
In my databases function text is different from what you show - in lower case:
SELECT OBJECT_DEFINITION (OBJECT_ID(âErp.listEntryâ)) AS ObjectDefinition;
CREATE function [Erp].[listEntry](@idx int, @list nvarchar(max), @delimiter nchar(1))
returns nvarchar(1000)
as
begin
declare @begin int, @end int, @count int
declare @str nvarchar(max)
set @count = 0
set @begin = 1
set @end = charindex(@delimiter, @list)
if @list is null
return (NULL)
if @idx < 0
return (NULL)
if (@end = 0) and @idx > 0
return (NULL)
if (@end = 0) and @idx = 0
return @list
set @str = @list
while charindex(@delimiter, @str) > 0 and @count < @idx
begin
set @begin = charindex(@delimiter, @str) + 1
set @str = substring(@str, @begin, len(@str) - @begin + 1)
set @count = @count + 1
end
if @count < @idx
return (NULL)
if charindex(@delimiter, @str) > 0
set @str = substring(@str, 1, charindex(@delimiter, @str) - 1)
else
set @str = substring(@str, 1, len(@str))
return (@str)
end
also, EDMX contains 3 function references, why do you see only one is recreatedâŚ
<edmx:StorageModels>
<Schema xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl">
<Function Name="ListCount" ReturnType="int" Schema="Erp" StoreFunctionName="listCount">
<Parameter Name="list" Mode="In" Type="nvarchar" />
<Parameter Name="delimiter" Mode="In" Type="nchar" />
</Function>
<Function Name="ListEntry" ReturnType="nvarchar" Schema="Erp" StoreFunctionName="listEntry">
<Parameter Name="index" Mode="In" Type="int" />
<Parameter Name="list" Mode="In" Type="nvarchar" />
<Parameter Name="delimiter" Mode="In" Type="nchar" />
</Function>
<Function Name="ListLookup" ReturnType="int" Schema="Erp" StoreFunctionName="listLookup">
<Parameter Name="item" Mode="In" Type="nvarchar" />
<Parameter Name="list" Mode="In" Type="nvarchar" />
<Parameter Name="delimiter" Mode="In" Type="nchar" />
</Function>
</Schema>
</edmx:StorageModels>
I just grep searched the entire decompiled code base and the only place I see this function ever being used (server side) is in the NatAcctMassUpdProcâŚ
Granted Reverse Engineered code isnât always 100% accurate but with function/method names its generally pretty reliable.
@Olga looks like the function is the same, the code I copied from the active SQL execution monitor so casing and spacing could be way off. Or the SQL compiler may be modifying some of it⌠That is weird though
That is a good question, not a clue⌠that seems to be the only one that âhangsâ and creates a blocking process. (When it happens)
sp_help âErp.listEntryâ shows when the function is created. maybe it coincide with app pool restart or some other activity?
It shows it was âcreatedâ over 2 years ago, so that script that is running and trying to create the function iâm guessing failing or something because the created date isnât being updated on the function.
this is the list of all DB objects that use it. I only have 2 : listLookup and listEntry. Check what you have
SELECT DISTINCT
o.name AS Object_Name,
o.type_desc
FROM sys.sql_modules m
INNER JOIN
sys.objects o
ON m.object_id = o.object_id
WHERE m.definition Like '%listEntry%';
Same as you just those 2.