Viewing 15 posts - 2,821 through 2,835 (of 3,957 total)
Let's assume that you're interested in a rolling 13 months and you are not tied to the column names you have specified. You can do this by a combination...
September 11, 2012 at 7:26 pm
YSL,
First you'll need to decide exactly what "measurements" of your sample data will lead you to the conclusions that you seek. That statement sounds a bit ironic but it...
September 11, 2012 at 6:40 pm
You can try this:
SELECT ID, Date
,Status=CASE WHEN GETDATE() < MAX(Date) OVER (PARTITION BY ID) THEN 'Active' ELSE 'Inactive' END
FROM Table1
September 11, 2012 at 6:26 pm
ChrisM@Work (9/11/2012)
DECLARE @AmountToAllocate INT = 21
;WITH Calculator AS (
SELECT
BucketID, TotalSize, Amount,
AmountLeftToAllocate =...
September 11, 2012 at 6:10 pm
Kingston Dhasian (9/11/2012)
Please describe the problem you have along with DDL, some sample data and the expected resultsCheck the link in my signature if don't know how to do this
You...
September 11, 2012 at 4:07 am
The first looks more like a bin packing problem to me:
http://sqlblog.com/blogs/hugo_kornelis/archive/2007/11/30/bin-packing-part-1-setting-a-baseline.aspx
There's a series of 5 articles by Hugo Kornelis at this link (to the first). Very complicated, but the...
September 11, 2012 at 4:03 am
shani19831 (9/11/2012)
Hi there,The image you posted is not opopeningp dude.
Regards,
The image does show when you access the link. Interesting problem but it won't be easy to come up with...
September 11, 2012 at 3:50 am
Sean Lange (9/10/2012)
You know simply repeating a vague description does nothing to help me understand it.
"Insanity is doing the same thing over and over again and expecting different results."
-- Albert...
September 11, 2012 at 2:51 am
Looks like a really, really, really dangerous approach to me.
Use IDENTITY.
September 11, 2012 at 2:46 am
Another guess:
select activity
, a.sponsor 'OldSponsor'
, sibling 'OldSibling'
, 4 'NewSponsor'
--, '?' 'NewSibling' --first result should be 3, second 4, etc based on max(sibling)+x for group sponsor=4
, ( SELECT MAX(sibling)
...
September 11, 2012 at 2:37 am
Jeff Moden (9/10/2012)
September 10, 2012 at 9:19 pm
ronmoses (9/10/2012)
September 10, 2012 at 5:58 pm
Better late than never?
DECLARE @num BIGINT = 1234567890
;WITH Tally (n) AS (
SELECT TOP (LEN(@num)) ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) FROM sys.all_columns)
SELECT (SELECT SUBSTRING(RTRIM(@Num), 1+LEN(@Num)-n, 1)...
September 10, 2012 at 1:22 am
Nasty piece of work this, but you could try tokenizing the string with a rCTE, replacing the token and then putting it all back together. First the setup data:
DECLARE...
September 9, 2012 at 8:04 pm
Indeed Gus, the new version of your query seems to be fastest.
========== Mark ===========================================
(20000 row(s) affected)
Table 'Worktable'. Scan count 0, logical reads 0, physical reads 0, read-ahead reads 0, lob...
September 9, 2012 at 6:39 pm
Viewing 15 posts - 2,821 through 2,835 (of 3,957 total)