Viewing 15 posts - 4,996 through 5,010 (of 26,490 total)
Lowell (6/16/2015)
your real function probably raises an error, sicne you have two variables:@tbl and @source_tbl, but only one...
June 16, 2015 at 10:29 am
Gangadhara MS (6/11/2015)
please look for my first post,i have included the schema as well as execution plan by editing it.
Two things. One, a picture of the execution plan...
June 16, 2015 at 7:10 am
Maybe this:
ALTER FUNCTION [dbo].[history] (
@Since DATE,
@EarliestDated DATE = '6/1/2014',
@LatestDated DATE = NULL,
@Number FLOAT,
@Year INT,
@Substitution INT = 5000000
)
RETURNS TABLE
AS
RETURN (
WITH
N0(n) AS (SELECT 1 FROM (VALUES (1),(1),(1),(1),(1),(1),(1),(1),(1),(1))dt(n)), --...
June 15, 2015 at 4:38 pm
TomThomson (6/15/2015)
sgmunson (6/15/2015)
sqldummy79 (6/15/2015)
I...
June 15, 2015 at 4:13 pm
Just an fyi since you figured out what was wrong, but it really helps if you format your code:
SELECT
preop.MPOG_Case_ID,
STUFF( (SELECT ',[' +...
June 15, 2015 at 3:37 pm
Would help if you provided the actual execution plan for the fast and slow query.
June 15, 2015 at 3:26 pm
No promises, but here is one possible rewrite:
CREATE FUNCTION [dbo].[SubQuery] (
@OnDate DATE,
@EarliestDated DATE,
@LatestDated DATE,
@Number FLOAT,
@Year INT,
@Substitution INT
)
RETURNS TABLE
AS
RETURN (
SELECT
...
June 15, 2015 at 2:34 pm
phosplait (6/15/2015)
Lynn Pettis (6/15/2015)
You are going to have do some work here as well:FROM dbo.SubQuery(DATEADD(day, num - 1, @First), @DatedStart, @DatedEnd, @Number, @Year, @Sub)
I thought maybe there was something I...
June 15, 2015 at 11:02 am
You are going to have do some work here as well:
FROM dbo.SubQuery(DATEADD(day, num - 1, @First), @DatedStart, @DatedEnd, @Number, @Year, @Sub)
June 15, 2015 at 10:12 am
phosplait (6/15/2015)
Alan.B (6/12/2015)
As a matter of practice, when using a cte tally table like you are, you may want to replace your WHERE clause with a...
June 15, 2015 at 8:59 am
phosplait (6/12/2015)
@Lynn, I would...
June 12, 2015 at 2:58 pm
Jeff Moden (6/12/2015)
phosplait (6/12/2015)
I am trying to run an inline TVF as a parameterized SQL query.Just to be sure, does the function code contain the word BEGIN anywhere in it?
One...
June 12, 2015 at 2:40 pm
Would help to see the DDL for the TVF, the table(s) involved, and the indexes defined.
On the first query where the data values are hardcoded you are getting key lookups...
June 12, 2015 at 2:26 pm
Are the dates user selectable or are they determined by when the query is run?
June 12, 2015 at 12:48 pm
Viewing 15 posts - 4,996 through 5,010 (of 26,490 total)