Forum Replies Created

Viewing 15 posts - 6,406 through 6,420 (of 8,731 total)

  • RE: COALESCE to replace multiple CASE statements

    Alvin,

    The code makes clear that there's a concatenation based on multiple values on a single column.

    CASE WHEN A.[COL_1] LIKE '%cricket%' THEN 'ck' + ',' ELSE '' END +

    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: COALESCE to replace multiple CASE statements

    I agree, a redesign to normalize the tables should help you solve this and other 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: COALESCE to replace multiple CASE statements

    I can't see why would you want to use COALESCE as you're not evaluating nulls.

    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: Order by desc for specific date

    Something like this?

    DECLARE @date = '20140701'

    SELECT TOP 1 *

    FROM MarketShare

    WHERE StartDate <= @date

    ORDER BY StartDate DESC

    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: Cursor-Killing: Accessing Data in the Next Row

    Don't be so sure about the control that you expect by the limit on the ID. The rows are still being generated and you can easily check it with 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: extraction of day month and year using SSIS

    You need to use brackets.

    DAY([DATE_ACTIVATION])

    That should help with the error.

    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: Cursor-Killing: Accessing Data in the Next Row

    I forgot to mention. Thank you for the article Ed. It's nice,I wish that I could use it more, but we haven't migrated to 2012 (or 2014). I have 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: Cursor-Killing: Accessing Data in the Next Row

    Pedro Gomes-379488 (5/27/2014)


    It's good to know about LAG and LEAD, that I didn't know of, but I use the approach below when faced with that kind of problem and don'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: Sum a Column by Client and Group by date 4 weeks apart!

    This is a possible solution but I'm not sure that it will work as it is for your data because I can't test it. This won't need a calendar table...

    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 a Column by Client and Group by date 4 weeks apart!

    Hi,

    This sounds relatively simple, but there's a problem. We need something to work with. Please post DDL, sample data (as insert statements) and expected output based on the sample data.

    Read...

    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 replace - with _

    Have you tried pressing F1 and looking for REPLACE? You should get to this nice article:

    http://msdn.microsoft.com/en-us/library/ms186862(v=sql.110).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: cross apply or other way

    Answer in the following thread:

    http://www.sqlservercentral.com/Forums/Topic1574051-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: Export in txt from sql (in a pivot way)

    The alternative could be the official unpivot.

    SELECT Val

    FROM (SELECT CAST( '1 cod ' + CAST( cod AS varchar(10)) AS varchar(20)) col1,

    ...

    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: hi

    I assume that the code you posted is part of a stored procedure. That stored procedure might be part of the procedures listed in here:

    SELECT PROCEDURE_NAME FROM PROCEDURE_TO_EXECUTE WHERE EXECUTE_PROCEDURE=1

    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: Export column from SQL to .txt format

    Maybe you didn't play enough with bcp. This article might help you.http://sqlsouth.wordpress.com/2014/05/23/export-xml-from-sql-server-using-bcp/

    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 - 6,406 through 6,420 (of 8,731 total)