Viewing 15 posts - 7,171 through 7,185 (of 8,731 total)
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] *
...
January 17, 2014 at 10:22 am
You could also use the column names in the original select instead of the alias.
SELECT po.Qte AS Q,
po.Prix AS P,
...
January 17, 2014 at 9:34 am
gwyn.jones (1/17/2014)
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...
January 17, 2014 at 9:27 am
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).
January 17, 2014 at 8:59 am
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...
January 17, 2014 at 8:55 am
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...
January 17, 2014 at 8:38 am
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...
January 16, 2014 at 5:30 pm
Could you post Full SQL and example here? I can't access to blogspot sites.
January 16, 2014 at 4:02 pm
Matt Miller (#4) (1/16/2014)
January 16, 2014 at 3:54 pm
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')
January 16, 2014 at 3:12 pm
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...
January 16, 2014 at 2:43 pm
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...
January 16, 2014 at 10:20 am
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.
January 16, 2014 at 9:55 am
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...
January 16, 2014 at 9:52 am
It seems that you just need to add the column Message to your group GROUP BY statement.;-)
January 16, 2014 at 9:45 am
Viewing 15 posts - 7,171 through 7,185 (of 8,731 total)