Support SQL Server inline table valued functions?
- Dominant language
- TSQL
- Stars
- 69
- Forks
- 55
- PR merge metrics
- No merged PRs in 30d
Description
**Is your feature request related to a problem? Please describe.**
We've been changing several of our table valued functions from the standard format like below to inline table valued functions
CREATE FUNCTION dbo.FN_SomeFunction(
@InputVar VARCHAR(50)
)
RETURNS @functionResult TABLE (
output VARCHAR(50)
)
AS
BEGIN
INSERT INTO @functionResult(output)
Select resultOutput as output
from dbo.TableA
where something = @inputVar;
RETURN
END;
We've found numerous performance improvements by using inline TVF functions where it's written like:
CREATE FUNCTION dbo.FN_SomeFunction(
@InputVar VARCHAR(50)
)
RETURNS TABLE
AS
RETURN (
Select resultOutput as output
from dbo.TableA
where something = @inputVar;
);
**Describe the solution you'd like**
@GoEddie
Is there a way to get SQLCover to cover these functions when a tSQLt test is created for this function? It does not show up in the list of evaluated code objects or in the coverage.coverxml outputs.
**Describe alternatives you've considered**
The only alternative I have is to put the functions back but then we degrade our performance.
===
Please at me @GoEddie so I receive a notification
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the issue with a SQL Server inline table-valued function and a tSQLt test. Inspect how SQLCover builds the list of evaluated code objects and the coverage.coverxml output. Done means inline table-valued functions appear in both coverage results when exercised by a test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sql
- Domain
- database
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100