Viewing 15 posts - 1 through 15 (of 920 total)
Bob Hovious (9/15/2009)
where there may be many factors beyond one's control
This is exactly why you DON'T want screen display time in the mix. It includes system processes that...
September 15, 2009 at 2:20 pm
Here's my "piecemeal" solution that works with any positive integer:
DECLARE @IntVal int;
SET @IntVal = 2147483647;
SELECT @IntVal / POWER(2,16), @IntVal % POWER(2,16);
SELECT
REPLACE(STR(ISNULL((SELECT SUM(POWER(CAST(10 AS bigint),h.number))
FROM master.dbo.spt_values h
WHERE h.type = 'P' AND...
September 15, 2009 at 1:58 pm
Bob Hovious (9/15/2009)
September 15, 2009 at 1:49 pm
I'm confused by your code snippets, but I think I understand your text.
If you want the result set to have multiple columns that you will subsequently concatenate, you could use...
September 15, 2009 at 10:12 am
Bob Hovious (9/15/2009)
And I'll take a helicopter over your hunter.Next you get a sparrow missile to shoot down my helicopter....
Does this mean you've found a method that's faster than the...
September 15, 2009 at 9:59 am
SQLBOT (9/15/2009)
Brilliant! Thanks.
I like the power and bitmask method of conversion.
That beats the modulus and division method (I think).
I should have specified that I wanted to use a tally...
September 15, 2009 at 9:49 am
Bob Hovious (9/15/2009)
2) It works with versions of SQL Server older than SQL Server 2005.
True, and I used to code that way before better techniques were made available in...
September 15, 2009 at 9:24 am
Bob Hovious (9/15/2009)
I do not know why such a long query has been posted.
;with cte as (select *,ROW_NUMBER() over(partition by vehicle order by dueHours) as seqID from @sample...
September 15, 2009 at 9:18 am
Dave Ballantyne (9/15/2009)
Non Cte
Table 'SalesOrderDetail'. Scan count 31466, logical reads 103081, physical reads 0, read-ahead reads 0, lob logical...
September 15, 2009 at 9:13 am
If you're fixed on using a "tally table," I guess you could try something like this:
DECLARE @IntVal int;
SET @intVal = 54321;
SELECT SUM(POWER(CAST(10 AS bigint),v.number))
FROM master.dbo.spt_values v
WHERE v.type = 'P' AND...
September 15, 2009 at 8:46 am
And here's the reminder about that keyword from SQL Server 2008 BOL:
ALL
This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in...
September 15, 2009 at 8:09 am
HowardW (9/15/2009)
September 15, 2009 at 7:58 am
If you have control over the schema design, please take Bob's advice. And read up on database normalization.
September 15, 2009 at 7:22 am
Bob Hovious (9/14/2009)
We forgive you for agreeing with us, PP 🙂
I'm afraid I cannot agree. I'd still use something like this:
SELECT ID, Vehicle, DueHours, DueName
FROM @sample s
WHERE DueHours IN
(SELECT...
September 15, 2009 at 7:14 am
SELECT ID, Dep, [Key]
FROM #Temp t
WHERE [Key] = 0 AND NOT EXISTS
(SELECT *
FROM #Temp
WHERE [Key] t.[Key] AND Dep = t.Dep)
September 15, 2009 at 6:06 am
Viewing 15 posts - 1 through 15 (of 920 total)