Forum Replies Created

Viewing 15 posts - 2,806 through 2,820 (of 2,894 total)

  • RE: Multiple Try Catch Blocks

    Look, your code does enter the next (second) "try" block! But why you expect "error, and display the "Round 2" select"? There is no error to catch in this block...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: TSQL Return start/end price and start/end datetime by product name.

    I need to clarify :

    elutin (6/2/2010)


    This one, does return proper results, However, on the given dataset sample, it performs 3 scans & 26 logical reads (incl. 24 reads of CTE...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: TSQL Return start/end price and start/end datetime by product name.

    This one, does return proper results, However, on the given dataset sample, it performs 3 scans & 26 logical reads (incl. 24 reads of CTE worktable) vs 34 scans but...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Multiple Try Catch Blocks

    Your code behaves exactly as it is written.

    It returns only one error as it is one error happens.

    Do you expect your code to stop after the firts error?

    Then you...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Only return records where all sub records match

    Instead of table structure, could you please provide CREATE TABLE and test DATA population scripts to represent your question in a way that would help your potential helpers. Something like

    CREATE...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: TSQL Return start/end price and start/end datetime by product name.

    Chris Morris-439714 (6/2/2010)


    This should be reasonably quick, and it's simple to understand and use, too:

    ...

    Unfortunately, your version will not work for situations where the price returns back to what it...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: TSQL Return start/end price and start/end datetime by product name.

    Bhuvnesh (6/2/2010)


    elutin (6/2/2010)


    As promised, another version. It contains much more code, but it's probably the fastest way to do what you require:

    ...

    ,@Product...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: TSQL Return start/end price and start/end datetime by product name.

    As promised, another version. It contains much more code, but it's probably the fastest way to do what you require:

    --We need to copy the data from the master table to...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: TSQL Return start/end price and start/end datetime by product name.

    I guess, using "quirky" update method will give better performance. I cannot show it today, but will do it tomorrow

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Struggling to engage brain! SQL code requiring a simple solution!

    Brandie Tarvin (6/1/2010)


    elutin (6/1/2010)

    SET @Package = NULLIF(@Package, '**SELECT ALL**')

    NULLIF? That's the first time I've heard of that function. I'm glad I read this thread.

    It's not really a function as such....

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Struggling to engage brain! SQL code requiring a simple solution!

    Sorry, you need small modification in it:

    SELECT id, EGType, Dates

    FROM dbo.Table_1

    WHERE (@Package IS NULL OR EGTYPE = @Package)

    AND (@Date IS NULL OR...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: TSQL Return start/end price and start/end datetime by product name.

    After looking into use of CROSS & OUTER APPLY (my curiosity was influenced by Paul White NZ who suggested more efficient solution for one of the last topics...)

    I can suggest...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: TSQL Return start/end price and start/end datetime by product name.

    What about if the price changes back to the same value as it was before:

    INSERT INTO #Temp (Name ,Price ,Date)

    ...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Struggling to engage brain! SQL code requiring a simple solution!

    If I'm guessing right, you're writing a stored proc.

    To avoid parameter sniffing (which happen in this kind of stored proc) copy values from stored proc input parameters into local variables...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Struggling to engage brain! SQL code requiring a simple solution!

    you can use this:

    DECLARE @Package char (50)

    DECLARE @Date smalldatetime

    DECLARE @nulldates bit

    -------------------

    SET @Package = '**SELECT ALL**'

    --SET @Package = 'A'

    -------------------

    SET @Date = '2010-05-01 00:00:00'...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

Viewing 15 posts - 2,806 through 2,820 (of 2,894 total)