Viewing 15 posts - 6,691 through 6,705 (of 8,731 total)
It can be done in SQL, but if you're using a reporting tool, you should do it in there.
March 25, 2014 at 11:38 am
Assuming you have @@DATEFIRST = 7, you could use this formula:
SELECT CASE WHEN DATEPART(DW, DATEADD( MM, DATEDIFF(MM, 0, GETDATE()), 0)) = 2
THEN DATEADD( DD, 4, DATEADD( MM, DATEDIFF(MM, 0, GETDATE()),...
March 25, 2014 at 9:40 am
The reason that makes the query work without the alias is that a.JOB_Date is different to JOB_Date which is the column alias.
I'm not sure how would you be able to...
March 25, 2014 at 9:27 am
And after some testing on SQL Server 2012, the DelimitedSplit8K still is the fastest solution posted in this thread. However, I haven't tested the new version presented by Eirikur in...
March 24, 2014 at 11:04 pm
You can concatenate the quotes
SELECT '''' + Column1 + '''' AS quotedColumn1
FROM TableA
March 24, 2014 at 10:06 pm
Why are you using 100, 101 & 102 for statos when you don't seem to have that values in your stato column?
March 24, 2014 at 11:51 am
Informer30 (3/24/2014)
1. output to csv or txt
2. then in excel import the csv or txt and I should see all of the 2million...
March 24, 2014 at 10:30 am
thava (3/24/2014)
how about a recursive idea
It's nice, but the DelimitedSplit8K version will work in half the time :-). You might not notice it with a few rows but it becomes...
March 24, 2014 at 9:32 am
Would this give you the correct result?
SELECT
Users.Department as Dept,
CaseTypes.Description as Case_Type,
Users.Code as FE,
COUNT(Matters.FeeEarnerRef) as No_of_Matters,
ISNULL(SUM(Usr_Int1.Estimated_total_fee),0) as Fee_Estimate
FROM
((Users LEFT JOIN Matters ON Users.Code = Matters.FeeEarnerRef and...
March 24, 2014 at 8:49 am
You need to provide more information. To find out what could be wrong, people need DDL for tables and indexes, as well as actual execution plan as described in this...
March 24, 2014 at 8:19 am
Using CROSS TABS you could achieve this easily without UNION ALL.
SELECT MAX( CASE WHEN system = 'system 1' THEN item END) system1
,MAX( CASE WHEN system = 'system 2' THEN item...
March 21, 2014 at 7:01 pm
Here's another option. I was thinking more of creating it for an iTVF (but leaving that part to you).
DECLARE @String varchar(20) = '00001001001';
WITH e1(N) AS(
SELECT N FROM (VALUES(0),(0),(0),(0),(0),(0),(0),(0),(0),(0))e(N)
),
cteTally(N) AS(
SELECT TOP(LEN(@String))...
March 21, 2014 at 3:06 pm
It depends, I would add a clustered index before thinking about a non-clustered one. It depends as well on the size of the table and the columns and rows used...
March 21, 2014 at 2:51 pm
Why do you say you can't use aggregate functions on dates? SUM isn't the only aggregate available.
Is this what you need?
Select @SQL2 = ISNULL(@SQL2+',','') + CHAR(13)
...
March 21, 2014 at 1:55 pm
That has always been like that. It's not new to 2008, it already existed on 2000. The query might have been changed.
March 21, 2014 at 1:25 pm
Viewing 15 posts - 6,691 through 6,705 (of 8,731 total)