Forum Replies Created

Viewing 15 posts - 5,281 through 5,295 (of 8,731 total)

  • RE: Function with 2nd part working on results 1st part

    I'm not sure that I understand the second parameter. This is what I've made.

    Note that I changed the scalar function into an InLine Table-valued function. To know why, read 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: parse a string every 6 letters

    No need for a loop and no need to cross post as it only fragments the solutions.

    Further answers in this thread: http://www.sqlservercentral.com/Forums/Topic1655566-392-1.aspx

    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: DAte Function

    MMartin1 (1/28/2015)


    Could the 'safe' plan that incurs a higher cost be helped by updating statistics?

    It could, but it won't be the same as the optimal plan.

    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: How to parse a string to equal length substrings in SQL

    This is one possibility:

    WITH E(n) AS(

    SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1 UNION ALL

    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: Function with 2nd part working on results 1st part

    I can't help you further if I only have a part of what you're doing.

    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: Function with 2nd part working on results 1st part

    Not a fan of this function as you might get performance problems, but maybe this is what you need.

    RETURN CASE WHEN @TimeInMins = 0

    THEN CONVERT(VARCHAR(2), LEFT(@RemainingSeconds,...

    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: How to optimize the below query?

    FWIW, imex's query will generate the same plan as yours but it's simpler to write.

    Phil's might be better or not, you'll need to test it before you implement it.

    For questions...

    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 a large amt of columns without aggregation

    This article about dynamic pivots and cross tabs could help you.

    http://www.sqlservercentral.com/articles/Crosstab/65048/

    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: DAte Function

    My guess (someone else might confirm it) is that the first needs to create a safe plan while the other one can create an optimized plan. The use of variables...

    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 help display all not only limit

    If you use a column in the where clause from a table joined by an outer join, your converting it to an inner join. Check the following alternative:

    SELECT COUNT(a.PatientID) AS...

    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: What is the prmary key then ?

    Sorry, my bad.

    Thank you for the correction Michael and the note about not being desirable.

    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: Pivot & unpivot

    Technically, the compatibility level would be 90 and up, but your idea is correct.

    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: IF statement with the Select

    montserrat.deza (1/27/2015)


    Luis I tested it and it worked!! thank you for your recommendation but I

    did it already.

    Internally, it makes no difference. Both queries should create the same execution plan.

    I...

    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: IF statement with the Select

    David Burrows (1/27/2015)


    As already pointed out your logic is flawed

    e.g. One interpretation of the flawed logic is to find all combinations of VALUEA in both tables where they do not...

    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: SUM(CASE(DATEDIFF Calculation Problem Involving a searched CASE Expression

    Would this work for you?

    SELECT

    well.wellide AS Prospect,

    well.wellidc AS Pad,

    well.wellname AS Well,

    job.idrec AS JobID,

    rig.contractor + ISNULL(' '+ rig.rigno,...

    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 - 5,281 through 5,295 (of 8,731 total)