Forum Replies Created

Viewing 15 posts - 7,261 through 7,275 (of 8,731 total)

  • RE: Any way to rerwirte this query?

    Sean Lange (1/7/2014)


    I am guessing that what you really want is all the rows from the function and values from the table if there is a match?

    This is where you...

    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: Any way to rerwirte this query?

    It makes no sense that your udf needs to come before your table if it uses a column from your table.

    This might help you:

    SELECT *

    FROM mytable a

    OUTER APPLY dbo.udf_Myfunction(a.col1) udf

    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: Update the Time of Day, but not the Date

    Here's another way to calculate it without the need of a triple conversion 🙂

    UPDATE @TheOriginalDates SET DateWithNewTime =

    DATEADD(SECOND, -1, DATEADD(DAY, DATEDIFF(DAY, 0, CurrentDate) + 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
  • RE: Complex Query. Please help

    It seems that you're facing the same problem as your previous post.

    http://www.sqlservercentral.com/Forums/Topic1524935-392-1.aspx

    And it was solved over there.

    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: Complex Query. Please help

    sqlnaive (1/6/2014)


    It's basically for OLAP environment so no worruies about using nolock. Your query seems good. But what do you think about the performance from the bulk (which i mentioned)...

    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: Complex Query. Please help

    Why do you have all those nolock hints? Are your users aware that they might get incorrect data? Are they okay with that?

    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: Complex Query. Please help

    You really should post consumable DDL and sample data. I'm in a good mood so I did it this time, but you've been here long enough to know how to...

    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: Where can i find the latest world map shape file?

    Lowell (1/3/2014)


    duplicate post.

    no need to cross post to multiple forums it fractures the answers you get and makes posters duplicate others work.

    the "Recent Posts" link shows us everything.

    continue the thread...

    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: The "Numbers" or "Tally" Table: What it is and how it replaces a loop.

    Generate_Series sounds like a great function, but it's not the same as Sequences in SQL Server (or Oracle FWIW).

    Sequences are used to fetch values but they will keep track of...

    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: The "Numbers" or "Tally" Table: What it is and how it replaces a loop.

    I'm not sure that sequences work the same way as a Tally table. It seems that their purposes are different.

    Could you explain how would you use a sequence instead of...

    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: using datediff against datapart

    Based on your sample data and explanation, it gets even simpler as you don't need any calculations.

    SELECT sum(Amount)

    FROM Coupon_Amount

    WHERE IdCoupon IN (

    SELECT IdCoupon

    ...

    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: Report adds a new year's data to the right of the report - way to automate?

    Your code seems really unefficient and unconsistent. Here's a better option to do it.

    SELECT client,

    SUM( CASE WHEN year = 2003 THEN fees_billed ELSE 0 END) as fees_billed_2003,

    SUM( CASE...

    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: using datediff against datapart

    I'm not sure that this will work fine because you didn't provide sample data.

    The logic of your query is not clear as the first between seems enough. If you...

    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: extracting dates from string(long text)

    This code is a modification from Dwain Camps' Pattern-based splitter.

    I'm not sure if it's the best way to do it.:-P

    DECLARE @List ...

    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: Exporting Data directly into Excel from SQL makes it too big to handle

    Have you consider that you can't paste 2.2 million rows in a single spreadsheet?

    Excel will limit the rows to 1,048,576.

    You're going to be missing over 50% of your data in...

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