Forum Replies Created

Viewing 15 posts - 7,036 through 7,050 (of 8,731 total)

  • RE: last 6 months data

    2 hints for you:

    1. Aggregate functions don't consider NULL values.

    2. Take a look at NULLIF function.

    EDIT: You don't need to cast your data, it will only get you wrong results....

    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: Hierarchical order by TSQL

    Hi, Welcome to the forums.

    I'll be glad to help you, but it would take me a while to prepare the data to be able to test any solution. Could 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: T-SQL Pivot Question

    Hi Alan,

    You need to change your table to a subquery involving only the grouping columns and the ones to be aggregated.

    SELECT [1] AS q1, [2] AS q2, [3] AS q3,...

    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

    As I told you, a WHERE clause will do the trick. And you can add values (or change to a full numbers table/view/function) to have even more months.

    DECLARE @val int...

    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

    Why would you choose 5 & 6 instead of 1 & 2?

    To make it dynamic, add a WHERE clause to the Months CTE and you might want to add more...

    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: Sort in the middle of an execution plan

    I don't know your complete requirements, but shouldn't you be showing a lot less rows (just one per cart)? If you just want to list the Carts with Maintenance, 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: need to update 2nd table if data exists in table 1

    I'll leave 2 other options, just for the fun.

    UPDATE t2

    SET found = 'OK'

    FROM #Table2 t2

    WHERE EXISTS( 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: Case select sql 2000

    You have some errors on the way you want to generate the query. You can't combine the assignment of variables with the return of results and you need to write...

    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: New Cartoons at SQLServerCentral

    I'm a little confused by this:

    I'll leave the name a secret for now, but look for a little fun in your mailbox this Wedneday, February 5, 2014.

    A few years ago...

    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: Replace String with a special character except first character of word (like A***)

    ajay.contact (1/31/2014)


    Thanks a lot Luis/SSCrazy. Your solution worked like magic :w00t:

    I hope not, because you shouldn't know how magic works and you need to fully understand how the posted solutions...

    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: Interview with the CTO ?!

    I wouldn't expect technical questions from the CTO. I believe that it should be more on:

    Why would they hire you?

    Personal experiences on problems and how were they solved.

    What kind 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: Sort, how to treat NULL as Max value

    Maybe something as simple as changing the NULL to a value as '9999-01-01'. It would be better if you do this in your table to avoid functions and possibly use...

    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: Replace String with a special character except first character of word (like A***)

    I'll leave you here 2 options based on solutions presented on a different thread for a ProperCase function found in here: http://www.sqlservercentral.com/Forums/Topic1531616-392-1.aspx

    The first solution uses the DelimitedSplit8K which is described...

    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: Change connection string insde the package.

    I'm not sure if it would work, so keep a backup of your packages.

    As SSIS packages are basically XML files, you could use Notepad++ (or another text editor that allows...

    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: Need to find returns where a given columns multiple returns do not contain a specific value in a different column of the result set.

    cmcfarland 51322 (1/31/2014)


    Thanks for taking a look at this!

    I get no errors, but no returns, either.

    That's probably because you might have NULLS in [Company Name].

    Here are the most common options:

    --Using...

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