Viewing 15 posts - 3,211 through 3,225 (of 4,085 total)
dwain.c (4/19/2012)
After that, you should ship it off to your reporting tool to do rest. You are going to have to pivot the results to get your counts...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
April 19, 2012 at 7:05 am
GilaMonster (4/18/2012)
That was just an example. Sub any 2008-specific feature.
I realize it was just an example, but if there were a 2008-specific feature that was required for the job,...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
April 18, 2012 at 3:03 pm
It looks like the first line is a grand total for Civil.
Part of the problem is that you're using T-SQL as a reporting tool and it's not. You'd be...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
April 18, 2012 at 2:35 pm
GilaMonster (4/18/2012)
drew.allen (4/18/2012)
How do you get the recruiter to understand that the differences between SQL 2005 and SQL 2008 are inconsequential?
How do you know they're inconsequential for the particular job?...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
April 18, 2012 at 1:10 pm
dwain.c (4/18/2012)
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
April 18, 2012 at 8:42 am
It would help if you formatted your code using the IFCode Shortcuts code="sql" so that we could more easily read your code.
select empname ,(
select case when empno is null...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
April 18, 2012 at 8:16 am
You'd probably get more responses if you posted in the correct forum. There is a forum specifically for SQL Server 2008 Administration.
Drew
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
April 16, 2012 at 2:57 pm
I should issue a caveat on that code. It is NOT necessarily equivalent to the original query. They will produce the same results if the data includes each...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
April 16, 2012 at 2:20 pm
As a note of comparison, ColdCoffee's approach requires four scans of the table and requires a total of 32 logical reads, whereas my queries only require one logical read per...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
April 16, 2012 at 1:25 pm
Here's an improved version of my original query. It only scans the table once instead of twice.
SELECT u.SourceA, u.SourceB, t.Counts
FROM #Temp1 AS t
CROSS APPLY(
SELECT SourceA, SourceB
UNION
SELECT SourceB, SourceA
) AS...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
April 16, 2012 at 1:18 pm
mtassin (4/16/2012)
Ummm?
SET DATEFORMAT DMY;
SELECT CONVERT(VARCHAR,GETDATE(),103)
That format has a leading zero on both the day and the month (05/04/2012). The expected results given drops the leading zero on the day,...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
April 16, 2012 at 12:46 pm
You're looking for a UNION, although you're duplicating a lot of your data by doing so. I'm not sure why you would want to do this.
SELECT SourceA, SourceB, Counts
FROM...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
April 16, 2012 at 12:10 pm
Mike01 (4/16/2012)
To avoid confusion for testing, use a day greater than 12.
Well, I think the point is that the format drops the leading zero on days, but not months, so...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
April 16, 2012 at 12:00 pm
Crystal Reports has a crosstab object that was specifically designed for this type of operation. It's MUCH, MUCH easier to do this Crystal than in T-SQL.
Drew
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
April 16, 2012 at 11:55 am
Here are two different ways to do it.
DECLARE @dateString DATETIME
SET @dateString = '2012-04-05'
SELECT @dateString,
CASE WHEN DATEPART(DAY, @dateString) < 10
THEN STUFF(CONVERT(varchar(10), @dateString, 103), 1, 1, '')
ELSE CONVERT(varchar(10), @datestring, 103)
END
,RIGHT(CONVERT(varchar(10), @dateString,...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
April 16, 2012 at 11:52 am
Viewing 15 posts - 3,211 through 3,225 (of 4,085 total)