Forum Replies Created

Viewing 15 posts - 7,066 through 7,080 (of 8,731 total)

  • RE: Which one of these three (2) WHERE clauses is BEST for PERFORMANCE?

    This explains the basics: http://bit.ly/1aKPF3N

    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!

    Jeff Moden (1/30/2014)


    "JOCC BOOSTR" (pronounced "jock booster")

    Definition:

    Justification Of Crap Code Based Only On Small Table Requirements

    🙂

    Everywhere

    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: Which one of these three (2) WHERE clauses is BEST for PERFORMANCE?

    I agree with Chris, you should try them.

    However, you might note that No.1 is using a function so it's not SARGable and No.2 is using LIKE with no wildcards, so...

    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: getDate(), each database is for different timezones

    A change to the function might be needed if the OP wants to include time offsets that don't use full hours as Venezuela which is UTC-04: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: Old SQL Code and Compatibility

    Not yet, but I wouldn't continue to use them in current or future development.

    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: Two results

    To know what's happening, we need you to post DDL and sample data in a consumable format (insert into statements). The reason for this is that we can't see what...

    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: Two results

    What's wrong with you current query? It seems to work as expected. Maybe you're having problems with your WHERE clause, try using some parenthesis.

    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: split range from table

    You're welcome. It was fun when I found numero and thought it was spanish but it was really italian. 😀

    If you have any questions on how does it work, feel...

    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: create a table with two primary keys.

    I'd say it depends on what you need because a table can't have 2 primary keys by definition. It's not about SQL Server, it's about relational theory.

    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: Islands question - I cannot channel Itzik this morning...

    Nevyn (1/30/2014)


    Using the analytic functions...

    I need a 2012 instance at work 😀

    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: Islands question - I cannot channel Itzik this morning...

    Here's an option you could use to create your groups.

    ;WITH Islands( Account, AStatus, SDate, grouper ) AS

    (

    SELECT Account,

    AStatus,

    SDate,

    ROW_NUMBER() OVER( ORDER BY SDate) -

    ROW_NUMBER() OVER( PARTITION BY AStatus 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: split range from table

    Hi Alessandro,

    Thank you for posting your sample data with DDL and insert statements.

    This solution might solve your problem, at least it works as expected on the sample data.

    WITH CTE AS(

    SELECT...

    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: Padding zeros after decimal

    Could you post DDL for the columns involved?

    EDIT: I'm asking because data types might perform different one from another and it would end in a wrong solution.

    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: Left join with "soft" condition

    Hi Alex,

    I was in a good mood and prepared the sample data, but I might not do it again, it's just to show you how it should be done.

    I'm including...

    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: last 6 months data

    You're very welcome. I hope that you learned something from this and you fully understand how the solution works. Remember to comment the code as you feel necessary to avoid...

    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 - 7,066 through 7,080 (of 8,731 total)