Forum Replies Created

Viewing 15 posts - 7,051 through 7,065 (of 8,731 total)

  • RE: Consolidating records

    It's more like:

    SELECT fname, lname, MAX(location1), MAX(location2)

    FROM #Something

    GROUP BY fname, lname

    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: converting year and month varchar to date

    Please don't post on multiple forums.

    All replies in this thread: http://www.sqlservercentral.com/Forums/Topic1536945-3077-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: converting Year and Month varchar to date

    You can add a derived column on the table with a formula as used below:

    WITH SampleData([Year], [Month], Productname ) AS(

    SELECT '2013', '11', 'ACB' UNION ALL

    SELECT '2013', '11', 'CDE'

    )

    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: Looking for more efficient way to perform this simple query

    You're welcome. I hope you understand how it works. If you don't, please post any questions that you have.

    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: Looking for more efficient way to perform this simple query

    There's an easier way and it's explained in this article: http://www.sqlservercentral.com/articles/T-SQL/63681/

    This is an example that might not work because I have nothing to test on.

    -- Daily Report

    SELECT UserID,

    SUM(CASE WHEN...

    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 and concatenate function

    The best splitter for T-SQL is right here[/url] along with several tests. It will outperform any splitter using while loops or xml.

    With it, you can replace your function to this....

    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?

    Sean Lange (1/31/2014)


    VoldemarG (1/31/2014)


    so from everything I heard/read, would that be fair to conclude that option 2 is the way to go in the majority of cases?

    2) where databasename ='myDBname'...

    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: Subtotal when vendorcode changed.

    Do you really need to do this in T-SQL? This is usually made in the front end.

    If it's completely needed on T-SQL, you might need to union the detail with...

    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 do I match values from a PIVOT?

    Sure, there's a different way to achieve it. I personally prefer the CROSS TABS method for pivoting data.

    Here's an example. If you have questions, feel free to ask.

    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: Find max and min where count of unique > x...

    Chris, I think you were expecting different results than the ones the OP asked for.

    I would go for the last query from o.fimin.

    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 is not working

    Define "does not work". Are you getting an error? What should it do and it's not doing? Or what is it doing that it shouldn't?

    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: Identifying long running queries SQL server

    Reviving a thread twice 😛

    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 is not working

    You have 1 BEGIN and 2 END.

    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?

    Would this help?

    http://www.sqlskills.com/blogs/kimberly/guids-as-primary-keys-andor-the-clustering-key/

    http://blogs.msdn.com/b/sqlserverfaq/archive/2010/05/27/guid-vs-int-debate.aspx

    Maybe even a post from a GUID lover:

    http://blogs.msdn.com/b/sqlazure/archive/2010/05/05/10007304.aspx

    Or even BOL on Using uniqueidentifier Data:

    http://technet.microsoft.com/en-us/library/ms190215(v=sql.105).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: By Pass Error While insetion

    Adam Angelini (1/30/2014)


    Use the MAXERRORS option and set it to a really high number.

    And use an errorfile to find out what failed.

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