Forum Replies Created

Viewing 15 posts - 1,966 through 1,980 (of 8,731 total)

  • RE: ROUND numbers with steps

    Lynn Pettis (10/27/2016)


    Luis Cazares (10/27/2016)


    Here's an example of the different behavior of ROUND and CEILING/FLOOR.

    Luis, your expected return values for the negative values are wrong. Rounding negative values up...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Today's Random Word!

    Grumpy DBA (10/27/2016)


    djj (10/27/2016)


    crookj (10/27/2016)


    Ed Wagner (10/26/2016)


    Revenant (10/26/2016)


    Grumpy DBA (10/26/2016)


    Ed Wagner (10/26/2016)


    High

    Low

    Lowlands

    Scotland

    FREEDOM!

    Slavery

    Lincoln

    Cadillac

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: ROUND numbers with steps

    Here's an example of the different behavior of ROUND and CEILING/FLOOR.

    WITH SAMPLE_DATA (SD_ID,SD_VAL,SD_EXPECTED) AS

    (

    SELECT 1, 0.1, 30 UNION...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: ROUND numbers with steps

    Quick correction.

    WITH SAMPLE_DATA (SD_ID,SD_VAL,SD_EXPECTED) AS

    (

    SELECT 1, 0.1, 30 UNION ALL

    SELECT 1, 10.1, 30...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Are the posted questions getting worse?

    Ed Wagner (10/26/2016)


    Phil Parkin (10/26/2016)


    Any clairvoyants here today?

    I admit that's very tempting, but I don't want to get drawn into a battle of sarcastic remarks that have nothing to do...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: SQL Transpose the data

    That's right, you need to replace the zeros with the columns available.

    To obtain the data in the new way (which should be the correct way to store it) you need...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: SQL Transpose the data

    Actually, it's not precisely a cross tabs issue, but some kind of unpivoting.

    Here's an example which is partially explained in this article: http://www.sqlservercentral.com/articles/CROSS+APPLY+VALUES+UNPIVOT/91234/

    SELECT [Customer], [Section], [Data], [Year], Jan, Feb, Mar,...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Finding Dupes based on previous weeks input.

    Is this Oracle? :crazy:

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Stored Procedure - that automatically fill the hourly

    Deries (10/26/2016)


    Luis, Thank you for the code and the suggestion. Really Appreciate it. We need to show hours in the secondary table as in the front end GUI we got...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: query compare date

    Here's a bit simpler version of DesNorton's query.

    SELECT MT.CaseID, MA.MinDate, MinDateCol = MA.ColName

    FROM @datetest AS MT

    OUTER APPLY (

    SELECT TOP(1) VA.ColName, VA.DateCol

    FROM (VALUES('MTDThresholdDate', MT.MTDThresholdDate),

    ...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Stored Procedure - that automatically fill the hourly

    Why do you want to store the data 24 times?

    You can achieve the result without having all that data stored. It's just a waste of storage when a query will...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Next Identity needed

    Now, that's weird. Have you tried reseeding the identity value?

    I'd post the syntax but I'm on my phone right now.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Concurrency - Please Provide Comments

    DesNorton (10/25/2016)


    Luis Cazares (10/25/2016)


    The reason for the CTE was to include the ORDER BY which isn't available in the simple UPDATE.

    The correct covering index also takes care of the order...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Concurrency - Please Provide Comments

    Phil Parkin (10/25/2016)


    Luis Cazares (10/25/2016)


    However, the OUTPUT clause will generate an empty result set when no rows are updated, so that should work.

    And with a single statement and the error...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Concurrency - Please Provide Comments

    However, the OUTPUT clause will generate an empty result set when no rows are updated, so that should work.

    And with a single statement and the error handling just throwing the...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2

Viewing 15 posts - 1,966 through 1,980 (of 8,731 total)