Viewing 15 posts - 661 through 675 (of 1,923 total)
zapouk (8/31/2011)
That seems to do it. I'd experimented with case and isnull but never got as far as using them using together. Thanks for this!
You're welcome. Thanks for setting up...
August 31, 2011 at 1:31 pm
toddasd (8/31/2011)
ColdCoffee (8/31/2011)
select ColA, ColB
from TestTable
order by isnull( ColA , ColB) ,
case when ColA is...
August 31, 2011 at 1:30 pm
toddasd (8/31/2011)
Nice shot, CC. You got there seconds before me 😉
😀
August 31, 2011 at 1:24 pm
This will be more robust:
select ColA, ColB
from TestTable
order by isnull( ColA , ColB) ,
case when ColA is not null...
August 31, 2011 at 1:15 pm
How about this ?
select ColA, ColB
from TestTable
order by isnull( ColA , ColB) , isnull( ColB ,ColA )
August 31, 2011 at 1:13 pm
A more cleaner version:
DECLARE @StartDATE DATETIME
SET @StartDATE = '01-01-1985'
;WITH Tens (N) AS
(
SELECT 0 N UNION ALL SELECT 0 UNION ALL SELECT 0 UNION ALL
...
August 31, 2011 at 12:33 pm
If you dont have a tally table, you can utilize this code :
DECLARE @StartDATE DATETIME
SET @StartDATE = '01-01-1985'
;WITH Tens (N) AS
(
SELECT 0 N UNION ALL SELECT...
August 31, 2011 at 12:27 pm
And Mr ( or Ms ) sdownen05 , thanks for setting up the problem fantastically 🙂 Right on the money ; appreciated 😎
August 31, 2011 at 11:42 am
Or this:
; WITH Distinct_Jobs AS
(
SELECT DISTINCT Job
FROM #JobOrder
)
SELECT CrsAppOutput.Job , CrsAppOutput.OperName , CrsAppOutput.Operation , CrsAppOutput.Complete
FROM Distinct_Jobs OuterTable
CROSS APPLY
(
...
August 31, 2011 at 11:41 am
And with proper index on YearMonth column, the script should complete in a jiffy. I wonder if a Quirky Update code can be bestowed on this puzzle :unsure:
August 31, 2011 at 11:25 am
Cadavre (8/31/2011)
Nice one Chris 😉Told you someone would simplify it Greg
Wooooosh... i dint see Chris posted a similar solution 😉
{ Note to self : Brush the teeth before even...
August 31, 2011 at 9:44 am
Wont this do?
Shamelessly utilizing the sample data that Cadavre prepared( Thanks Cad)
DECLARE @TABLE AS TABLE (Yearmonth DATETIME, Metric1 INT, Metric2 INT)
INSERT INTO @TABLE (Yearmonth, Metric1)
SELECT '2010/01/01', 1 UNION ALL
SELECT...
August 31, 2011 at 9:41 am
patrick.bewley (8/30/2011)
This query has been simplified from a dynamically built PIVOT query.
I so expected this 🙂 I need to just hash thro some of my old code,...
August 30, 2011 at 9:29 am
I second what Sean says, formatting is to done at the front end.
But, doesnt this work for you ( or am i missing the obvious ?? )
DECLARE @Budget TABLE
(
ID INT...
August 30, 2011 at 9:19 am
simflex-897410 (8/29/2011)
WOW, great stuff!Thanks a lot for the prompt response and your help. Works great!!
Glad i could help 🙂
Have a look at my previous post also on not casting an...
August 30, 2011 at 7:54 am
Viewing 15 posts - 661 through 675 (of 1,923 total)