All Questions
Tagged with user-defined-functions sql-server
676 questions
0
votes
1
answer
125
views
Deterministic Property not Working as Expected in UDF
I am creating an UDF expecting to be deterministic, i.e., it should give same result for same input. But it is not working as expected when the table is updated.
Step #1. Create a table and insert few ...
0
votes
1
answer
81
views
INSERT INTO SELECT subquery that uses a udf so that it returns 1 value
I'm attempting to create a new table but altering some of the data from my old table using a INSERT INTO SELECT statement. I'm trying to take a field with numbers and letters and pull out the numbers ...
-1
votes
1
answer
98
views
How can I optimize SQL code when needing to repeatedly call a scalar function for a substantial number of rows?
Here is a table called 'Operations' with a bunch of dates, and I need to find the time differences between six specific dates. But when I try to do this, it takes forever because the table has a lot ...
0
votes
0
answers
116
views
Decompress SQL Server column field in pyspark (Databricks)
I'm trying to find a way to decompress a column in pyspark from a SQL Server Table exported in parquet.
What i have:
1. SQL Server Table with an xml compressed field
This is the original column type: ...
0
votes
1
answer
42
views
Select a field from a table and the values of a table-returning UDF related to that field
I have a function which returns a table with a single row.
Basically this table stores information about a string like:
|IsPrintable|OriginalString|CleanString|
Let's assume a table with two columns ...
0
votes
2
answers
56
views
SQL scalar-valued function slow performance
I'm trying to optimize a query to remove the scalar valued function that returns a comma separated list example 'cor tag 1, tag test, testing, test.' I've read online that making it inline should ...
0
votes
1
answer
157
views
Calculate String on SQL Server Function
I'm trying to find a workaround to calculate string in SQL Server just like the eval() function on JavaScript. What makes it difficult is I need it to do it in function so that I can use it on my ...
0
votes
1
answer
106
views
How to call SQL user function from another one, only if it exists on SQL Server 2022?
Problem:
SQL server 2022 nondeterministically throws
Cannot find either column "ext" or the user-defined function or aggregate "ext.cfn_Something", or the name is ambiguous.
in a ...
0
votes
2
answers
86
views
SQL Server can't find user created function
I have multiple Account Type codes stored in a VARCHAR field separated by semi-colons. I need the names associated with the Codes in a single string.
I am trying to use a pair of functions.
ALTER ...
1
vote
0
answers
108
views
Why the drastic performance increase WITH SCHEMABIND?
I was running a complex query that taking 10 minutes or so to execute.
I tracked down a UDF that was regularly called & added WITH SCHEMABINDING to said function. Now the complex query takes ...
0
votes
1
answer
1k
views
Creating a Scalar-valued function
Perhaps this approach itself is not correct, but, here is what I did and what I am trying to achieve.
I have a series that looks like this:
value
1.0000
2.0000
3.0000
4.0000
5.0000
6.0000
7.0000
8....
-1
votes
1
answer
109
views
Multiple table-based replacement in a SQL function
I need to create a function that performs multiple replacements in a string based on a lookup table. However, the result is always the last replacement as if the previous replacements don't happen. ...
1
vote
1
answer
277
views
Is 100 a magic number for cardinality estimation of SELECT * FROM [Multi-Statement-Table-Valued-Function] queries?
I'm running on SQL Server 2019. Whenever I write a query of the form
SELECT *
FROM [Multi-Statement-Table-Valued-Function]
the execution plan shows that it expected to get 100 rows from this process....
1
vote
1
answer
605
views
Do User-Defined Scalar Valued Functions still prevent parallelism?
I'm currently reading a book about SQL Server 2014. It claims that User-Defined Scalar Valued Functions prevent parallelism for the entire plan that they appear in. Is this still true in later ...
0
votes
0
answers
52
views
User defined function in Entity Framework Core returning null
I am trying to call an user-defined function with Entity Framework Core. This is the function in SQL Server:
create function udf_CreateNextBookingId()
returns varchar(5)
as
begin
declare @...