Forum Replies Created

Viewing 15 posts - 7,171 through 7,185 (of 8,731 total)

  • RE: Very SIMPLE query working in Access not working on Sql Server

    Correct formatting and short table aliases should make the queries easier to read.

    It's not the same to read:

    SELECT [MyTable].[Long Column Name] AS A, [MyTable].[AnotherColumnName] AS B, [MyTable].[Long Column Name] *

    ...

    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: Very SIMPLE query working in Access not working on Sql Server

    You could also use the column names in the original select instead of the alias.

    SELECT po.Qte AS Q,

    po.Prix AS P,

    ...

    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: Substring / Patindex for wildcard select

    gwyn.jones (1/17/2014)


    Thanks 🙂

    I will try that case. Cannot use where as script is huge as it is with lots of unions and where clauses so just wanted a nice...

    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 case statement

    I'm not sure if it will help performance wise, but it might improve readability if you include your cases in a lookup table (or cte).

    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: Outer Apply/Cross apply or a join I haven't thought of?

    I was going to post the same solution as Keith, but as long as I'm here, I would note that you might not need to use unitnumber column in partition...

    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: Convert(Varchar,GetDate(),???) - List of Format Codes

    At work we usually use 112 or 120 and if I need a different format I usually look for it on BOL. It helps when you're not always working 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: ProperCase Function

    I just love when people continue to post to get better solutions.

    Mr. Magoo, it's really nice how you handle the start of a word. However, it might generate problems...

    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: Match exact item combinations for worker compensation

    Could you post Full SQL and example here? I can't access to blogspot sites.

    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 date of Nth crash for every car_make in every country

    Matt Miller (#4) (1/16/2014)


    by the way - you will want to incorporate the event_date into the ORDER BY, otherwise the row_number() will essentially assign numbers within a group ad-hoc (i.e....

    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: Do While or Cursor?

    Here's another set-based solution 😉

    UPDATE t SET

    order_class = 'MTO'

    FROM #Table t

    WHERE order_class <> 'MTO'

    AND EXISTS( SELECT *

    FROM #Table x

    WHERE x.custNo = t.custNo

    AND x.order_class = 'MTO')

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

    Ed, you gave me an idea an here's what I came out with after playing with the Jeff's splitter. Dohsan would be able to change the word delimiters as he...

    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: move calculation to right side

    You have a difference, but it's just by one day.

    The easiest way to test this is to run a query against a calendar table that will return all dates and...

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

    That's nice Dohsan,

    Just make sure my function gets the correct results as it won't check for characters different than spaces when trying to capitalize the first letter of each word.

    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: Help Needed with Max syntax

    Sean Lange (1/16/2014)


    What is the expected output based on the sample data?

    Hey Sean,

    It seems that the OP wrote the expected results and attached the sample data. So adding message column...

    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: Help Needed with Max syntax

    It seems that you just need to add the column Message to your group GROUP BY statement.;-)

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