Re: MS SQL error: There is insufficient system memory
You don't specify server and db size.
But what I would personal be doing initial would be checking the autogrow of tempdb, checking the Maximum server memory property and trying to see if the query would run on a similar non function Tsql.
Also db size? Is it high, maybe that would be an issue but not sure on that.
Secondly, I know nothing about GoDaddy server but maybe the allocation of system memory to applications memory becomes and issue?
Re: MS SQL error: There is insufficient system memory
MS SQL Server 2019...and all DB's and Log's are looking pretty small to me
The guts of the function runs outside the function - just in query window.
It's cutting the first name off - really silly simple stuff.
Something is way off here on some server setting.
I've been running the BIDS database for almost a year with no problems from those users.
I'm setting up a personal use DB (the ACS one) for myself and can't get something simple to run.
Code:
Use ACS
Go
DROP Function dbo.GetName_F
Go
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE FUNCTION dbo.GetName_F (@Name as varchar(50),@Opt as tinyint)
RETURNS varchar(50) AS
BEGIN
Declare @WN as varchar(50)
Declare @FN as varchar(50)
Declare @LN as varchar(50)
Declare @SN as varchar(50)
Declare @C1 as int
Declare @C2 as int
Set @WN=@Name
Set @C1=CharIndex(',',@WN)
If @Opt=0
Begin
Set @C1=CharIndex(',',@WN)
If @C1 = 0 Set @C1=Len(@WN)+1
Set @C2=CharIndex(',',@WN,@C1+1)
If @C2=0
Begin
If @C1>Len(@WN)
Set @FN=''
Else Set @FN=LTrim(Right(@WN,Len(@WN)-@C1))
Set @SN=''
End
Else
Begin
Set @FN=RTrim(LTrim(SubString(@WN,@C1+1,@C2-@C1-1)))
Set @SN=LTrim(Right(@WN,Len(@WN)-@C2+1))
End
Set @LN=RTrim(Left(@WN,@C1-1))
Set @WN=LTrim(@FN+' '+@LN+@SN)
End
Else
Begin
If @Opt=1
Begin
If @C1<>0 Set @WN=Left(@WN,@C1-1)
End
If @Opt=2
Begin
If @C1=0
Set @WN=''
Else Set @WN=LTrim(Right(@WN,Len(@WN)-@C1))
Set @C1=CharIndex(',',@WN)
If @C1<>0 Set @WN=Left(@WN,@C1-1)
Set @C1=CharIndex(' ',@WN)
If @C1<>0 Set @WN=Left(@WN,@C1-1)
End
If @Opt=3
Begin
If @C1=0
Set @WN=''
Else Set @WN=LTrim(Right(@WN,Len(@WN)-@C1))
Set @C1=CharIndex(',',@WN)
If @C1<>0 Set @WN=Left(@WN,@C1-1)
Set @C1=CharIndex(' ',@WN)
If @C1<>0
Set @WN=Right(@WN,Len(@WN)-@C1)
Else Set @WN=''
Set @C1=CharIndex(' ',@WN)
If @C1<>0 Set @WN=Left(@WN,@C1-1)
End
If @Opt=4
Begin
If @C1<>0 Set @C1=CharIndex(',',@WN,@C1+1)
If @C1<>0
Set @WN=Right(@WN,Len(@WN)-@C1-1)
Else Set @WN=''
End
End
RETURN @WN
END
GO
--GRANT EXECUTE ON GetName_F TO CustomerUser
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
*** Read the sticky in the DB forum about how to get your question answered quickly!! ***
Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".