Forum Replies Created

Viewing 15 posts - 2,566 through 2,580 (of 4,087 total)

  • RE: Using table name variable without dynamic SQL

    stricknyn (6/10/2016)


    Hi Drew,

    Thanks for your response. Unfortunately no. The other process is designed that way because there are other processes (much like this stored procedure) that will be...

  • RE: Using table name variable without dynamic SQL

    No, but you can pass a table variable into a stored procedure. Can you modify the other process to create a table variable rather than a temp table?

    Drew

  • RE: Alternate Way to Write query: ISNULL function causing issues

    Jeff Moden (6/9/2016)


    drew.allen (6/9/2016)


    Jeff Moden (6/6/2016)


    And notice that Drew did NOT suggest using 9999-12-31. That's because the classic method of isolating date ranges requires a "AND SomeDTColumn < @EndDate...

  • RE: Alternate Way to Write query: ISNULL function causing issues

    Jeff Moden (6/6/2016)


    And notice that Drew did NOT suggest using 9999-12-31. That's because the classic method of isolating date ranges requires a "AND SomeDTColumn < @EndDate +1" and all...

  • RE: Running Totals,

    This actually might perform better, but it requires that the earliest balance not be NULL, which is not true of your sample data.

    SELECT b.*,

    FIRST_VALUE(m.Balance) OVER(...

  • RE: Duplicates and ROW_NUMBER ()

    etl2016 (6/9/2016)


    Dear All,

    We use ROW_NUMBER () to partition results and hand-pick the needed records, mostly to address duplicate records scenario.

    However, how do we sense that there is a potential threat...

  • RE: Alternate Way to Write query: ISNULL function causing issues

    simon.barnes (6/8/2016)


    a) both the things DouglasH said

    b) you mentioned they were heaps and now have indexes; but do they now have clustered indexes? If not then they're still heaps. This...

  • RE: Running Totals,

    It looks like the piece you might be missing is a calendar table to make sure that you have all of the dates instead of just the dates where there...

  • RE: T-SQL: Aggregate and/or conditional subquery on where clause

    Jacob Wilkins (6/8/2016)


    So there are two separate problems.

    There's actually a third problem, but I don't want to say what it is, because the OP needs to understand how this query...

  • RE: "Conversion failed when converting date and/or time from character string" when using table that stores date functions

    There is no need for dynamic SQL here. He's storing these values in a temporary table, and the values aren't going to change (in most cases) between when he...

  • RE: "Conversion failed when converting date and/or time from character string" when using table that stores date functions

    erouse (6/8/2016)


    Thanks for your reply Drew but the quotes aren't stored in the tables. If we run SELECT * from #mydaterangetable WHERE tbldaterangeID =3 we get:

    3Last 7 daysDATEADD(day,...

  • RE: "Conversion failed when converting date and/or time from character string" when using table that stores date functions

    That because you have your "date expressions" enclosed in quotes when inserting into the temporary table. The are never evaluated, so they never produce dates.

    Drew

  • RE: T-SQL: Aggregate and/or conditional subquery on where clause

    marcossuriel (6/8/2016)


    Hello Drew,

    I did look at the results I'm getting over and over and I'm trying to understand what the ROW_NUMBER() is doing, but I'm a little lost. I see...

  • RE: T-SQL: Aggregate and/or conditional subquery on where clause

    marcossuriel (6/7/2016)


    Hello Jacob,

    I have the results I want from the dataset provide, but not sure how to show them in table view on here.

    lotnoitemnodescwarehousecurrentqtycosttransdatetranstypetransqty

    005965001TEQU0110 ...

  • Viewing 15 posts - 2,566 through 2,580 (of 4,087 total)