GoEddie / SQLCover

Apache License 2.0
63 stars 52 forks source link

Support SQL Server inline table valued functions? #64

Open jpdougherty opened 3 years ago

jpdougherty commented 3 years ago

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

priyasomangali commented 2 years ago

hi @jpdougherty , did you find any way to handle the above ?