Viewing 15 posts - 1 through 15 (of 29 total)
Why have ISO when you can have Her Majesty's Revenue and Customs! 🙂 🙂 🙂
May 5, 2015 at 8:23 am
From what you've said, I think its also important to determine when your fiscal "week 1" ends. Since your fiscal "Day 1" could be any day of the week, then...
May 5, 2015 at 8:06 am
Does this report have to be written in T-SQL? Using an Excel pivot table with a data connection to the tables would allow for a dynamic output (as long as...
March 24, 2015 at 7:57 am
.. so why won't a sumple SUBSTRING(@str,from,length) do the job?
(like wot Chris said! 🙂 )
March 17, 2015 at 7:46 am
You could replace the multiple spaces with a single space first:
WHILE PATINDEX('% %',@str)>0-- replace multiple spaces with single spaces
BEGIN
SET @STR=REPLACE(@str,' ',' ')
END
So the whole thing...
March 17, 2015 at 4:36 am
Assuming normalising the tables isn't an option for you, how about something like this:
WITH cte AS (SELECT * FROM (VALUES (1),(2),(3)) AS temp (no))
SELECT 'DAR-901 MDES' as STUDYID,IR.VSFORMID as SVFORMID,...
March 12, 2015 at 9:21 am
Am I missing something, or aren't all those unions to the same source tables with the same joins and where clauses? The only difference I can see is in the...
March 12, 2015 at 8:12 am
cbrammer1219 (3/11/2015)
andyscott you actually had it returning Thursdays..
Depends on your SET DATEFIRST settings: Whilst the default (English,US) is 7, meaning weeks start on Sunday, in the UK it is quite...
March 11, 2015 at 8:38 am
Perhaps a better soultion would be to use the LEAD and LAG windowing functions to avoid the self join and thus do it in a single query without using a...
March 11, 2015 at 5:25 am
How about this group of ctes? The first cte creates a table of Dates for the current year, the second cte expands these to add the Year, Month and DayOfWeek,...
March 11, 2015 at 5:12 am
How about
WITHcte1 AS (SELECT a.id, a.account, a.deposit, SUM(a.deposit) OVER (PARTITION BY a.account ORDER BY a.id) AS 'total',max(b.budget) as budget
FROM #TestData a
INNER JOIN #TestBudget b on (a.account = b.account)
GROUP BY a.id,...
March 4, 2015 at 1:19 am
If there is only ever one mid-string space then the split could be done as follows:
DECLARE @STR CHAR(40)= 'something unit'
SELECTSUBSTRING(@Str,1,CHARINDEX(' ',@Str)-1) AS [LeftPart],
SUBSTRING(@Str,(CHARINDEX(' ',@Str)+1),LEN(@Str)) AS [RightPart]
March 3, 2015 at 7:45 am
Can I take it you're trying to compare a date in a table with another that you're constructing on the fly?
i.e. that r.dbAddDate >= some date?
But "some date" in your...
March 3, 2015 at 7:22 am
mickyT (9/16/2014)
Can you share how you did it? I used the following.........
Nothing like as elegant as that! I didn't appreciate the power of UnionAggregate and spent my...
September 17, 2014 at 4:14 am
A breakthrough! I've managed to find a way to sort the individual line segments into order, reversing those that were "backward" with respect to the others. In the process I...
September 16, 2014 at 10:43 am
Viewing 15 posts - 1 through 15 (of 29 total)