Forum Replies Created

Viewing 15 posts - 4,756 through 4,770 (of 8,731 total)

  • RE: Is there a reason for the ISO behaviour of ANSI_NULL?

    The best reason that I've encountered is consistency. We can't treat NULL values the same way as other values when comparing them. What would you expect when you use SomeValue...

    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: Select Query

    An improved version of my previous code. 😉

    IF OBJECT_ID('TablesInformation') IS NOT NULL

    DROP TABLE TablesInformation;

    CREATE TABLE TablesInformation(

    name ...

    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: Turning datediff minutes into dd:hh:mm

    This is another formula to get there.

    WITH TestData AS(

    SELECT GETDATE() - RAND(CHECKSUM(NEWID())) * 7 AS date1, GETDATE() + RAND(CHECKSUM(NEWID())) * 7 AS date2

    ...

    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: Select Query

    Without having to rely on an undocumented procedure, you could use something like this:

    IF OBJECT_ID('TablesInformation') IS NOT NULL

    DROP TABLE TablesInformation;

    CREATE TABLE TablesInformation(

    name...

    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: Help with an update query

    As you said you're looking for an update query, I thought on posting an answer using some 2012 capabilities. Along with the use of updatable CTE's which work under 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
  • RE: Sql Qurey Subtract Data on Hourly basis

    But your excel file with the expected results didn't follow a common logic for all the rows.

    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?

    GilaMonster (7/2/2015)


    Informal survey before I make a fool of myself in an article (again)

    Do you get the feeling that IT people, especially ones at the top-end of the field, are...

    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: Help with SQL - Calculate time difference for consecutive rows

    Thank you for the formatted expected results Lynn. You're right, the results are different. However, I'm not sure if the expected results are wrong or the query results are wrong.

    For...

    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?

    Sean Lange (7/2/2015)


    Luis Cazares (7/2/2015)


    jasona.work (7/2/2015)


    Today is the kind of day (and it's only been an hour and a half since I got to work) that you clock watch...

    OTOH, 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: Previous Years Report

    gazy007 (7/2/2015)


    Thanks Luis, But I am not getting right numbers for 2015 and 2016 as we need to get for the whole year rather than getdate() or today. I hope...

    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: Help with SQL - Calculate time difference for consecutive rows

    Sean Lange (7/2/2015)


    Thanks Gail and Luis. Don't know how I missed that. 😛

    Probably your mind is already in a long weekend.

    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: Help with SQL - Calculate time difference for consecutive rows

    I'm not sure about your desired results, but I believe that you need to add a partition to your window functions.

    SELECT

    S_ID,

    LAG(S_ACTV_CODE, 1)...

    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?

    jasona.work (7/2/2015)


    Today is the kind of day (and it's only been an hour and a half since I got to work) that you clock watch...

    OTOH, got plenty to look forward...

    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?

    Lynn Pettis (7/1/2015)


    How do people keep their jobs when it is obvious they are dependent on the good will of strangers on the internet to diagnose and resolve database issues,...

    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: Pivoting question

    Steve,

    Just as an FYI, you can remove the ISNULL() by using the third parameter of LAG()

    --Instead of

    ISNULL(LAG(P.Lev, 1) OVER(PARTITION BY T.AccountID ORDER BY T.Datekey), 0) AS LAG_VALUE

    -- Use

    LAG(P.Lev, 1, 0)...

    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 - 4,756 through 4,770 (of 8,731 total)