Viewing 15 posts - 5,236 through 5,250 (of 10,144 total)
Since the numbers are no longer random, why not break the randomness rules again and use this very simple algorithm?
;WITH SampleData AS (
SELECT ID = RIGHT('0'+CAST(n AS VARCHAR(2)),2)
FROM (SELECT TOP...
February 8, 2013 at 2:43 am
dwain.c (2/8/2013)
vinu512 (2/7/2013)
...8 seconds? What are you using? A netbook with an Atom processor?
............
It must have been. That or a wristwatch. It resolved something like 100000 rows in...
February 8, 2013 at 1:58 am
greg.bull (2/8/2013)
February 8, 2013 at 1:54 am
vinu512 (2/7/2013)
SELECT df = LEFT(b.AllLevels, CHARINDEX('»',b.AllLevels,1)-1)
UNION ALL
SELECT df =...
February 8, 2013 at 1:45 am
Sean Lange (2/7/2013)
Select Id,
MAX(Case When ItemNumber = 1 Then Item Else '' End) As...
February 8, 2013 at 1:31 am
mjbkm (2/7/2013)
OK, I was closer.Also, I applied this to my live query and I got this error:
Divide by zero error encountered.
-- replace this
SELECT Percentage = CAST(q.Amount*1.00/q.GroupTotal AS NUMERIC(5,2))
-- with this...
February 7, 2013 at 9:23 am
Sean Lange (2/7/2013)
ChrisM@Work (2/7/2013)
Actually I misread your post Sean - thought you had used the "aggregate in a derived table" trick, or I wouldn't have posted this!
I am not sure...
February 7, 2013 at 9:12 am
mjbkm (2/7/2013)
Got it!!!!!!!!...
Not quite...
WITH SampleData ([Group], [Type], Amount) AS (
SELECT 'Dog', 'Typea', 1 UNION ALL
SELECT 'Dog', 'Typeb', 2 UNION ALL
SELECT 'Dog', 'Typec', 3 UNION ALL
SELECT 'Cat', 'Typea', 10...
February 7, 2013 at 9:11 am
mjbkm (2/7/2013)
ChrisM@Work (2/7/2013)
Aggregate Amount by Group and type, then feed the result into Sean's original query.
That is where I was stuck before. How would I change this?
SELECT
[Group],
[Type],...
February 7, 2013 at 8:55 am
It can be easier to visualise complex filters by switching them into a CROSS APPLY for testing. Shamelessly nicking Orlando's setup, it might look like this;
USE tempdb;
IF OBJECT_ID(N'tempdb..#CLIENT_IDENTIFIER_TYPE') IS NOT...
February 7, 2013 at 8:54 am
Aggregate Amount by Group and type, then feed the result into Sean's original query.
February 7, 2013 at 8:41 am
mjbkm (2/7/2013)
February 7, 2013 at 8:23 am
Sean Lange (2/7/2013)
ChrisM@Work (2/7/2013)
;WITH SampleData ([Group], [Type], Amount) AS (SELECT 'Dog', 'Typea', 1 UNION ALL
SELECT 'Dog', 'Typeb', 2 UNION ALL
SELECT 'Dog', 'Typec', 3 UNION ALL
SELECT 'Cat', 'Typea', 10 UNION ALL
SELECT...
February 7, 2013 at 8:22 am
;WITH SampleData ([Group], [Type], Amount) AS (
SELECT 'Dog', 'Typea', 1 UNION ALL
SELECT 'Dog', 'Typeb', 2 UNION ALL
SELECT 'Dog', 'Typec', 3 UNION ALL
SELECT 'Cat', 'Typea', 10 UNION ALL
SELECT 'Cat', 'Typeb', 20
)
SELECT...
February 7, 2013 at 8:08 am
carlosaamaral (2/7/2013)
changed to level 100 - perfect ..
; WITH THE Strings (
SELECT String = 'AJKY.GSEFD6, 7345535HNB, BBN4343.434'
UNION ALL SELECT '11-908 / *** 88AB; '
)
SELECT
s.String,
x.NewString
FROM Strings...
February 7, 2013 at 7:51 am
Viewing 15 posts - 5,236 through 5,250 (of 10,144 total)