Viewing 15 posts - 8,386 through 8,400 (of 8,731 total)
For a small improvement, change the "Original" definition:
Original AS(
SELECT CASE WHEN C1 < C2 THEN C1 ELSE c2 END AS C1,
CASE WHEN C1 < C2 THEN C2 ELSE C1 END...
September 20, 2012 at 8:46 am
Eugene Elutin (9/20/2012)
jcrawf02 (9/20/2012)
Eugene Elutin (9/19/2012)
Jeff Moden (9/18/2012)
Eugene Elutin (9/18/2012)
Please ignore this stupid remark!Easy, big guy. You're right but that's something that he would say. 😉
I've spent 5...
September 20, 2012 at 8:28 am
I might be doing some extra work with this query and someone could find a better way to do it.
However, it's an option that you can analyze.
DECLARE @test-2TABLE(
C1 int, C2...
September 20, 2012 at 7:44 am
siggemannen (9/20/2012)
These kind of queries have real usage, for example if you want to preserve "duplicate rows" of Col1, Col2, which cannot be preserved if you only Group By Col1
Why...
September 20, 2012 at 7:25 am
I'm Firebird user, in Firebird context value (inserted, updated, or deleted) in trigger is always single row which not always true in Sql Server.
To make it clearer for you,...
September 20, 2012 at 7:03 am
It's not clear (at least for me). What logic do you use to say a field is a related field?.
You should take a look at the link in my signature...
September 20, 2012 at 6:54 am
You get too complicated. This should work.
This will also give incomplete information on how the groups are made.
SELECT Col1, Count(*) AS Count_Rec
...
September 19, 2012 at 12:51 pm
For a dynamic solution, you should read this article:
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
[/url]
And maybe the first part as well.
September 18, 2012 at 2:12 pm
I believe this would be safe and simple to validate it's 2008 or higher. Is it possible to use SQL Server 1? 😛
IF CONVERT(int, CONVERT(char(1), SERVERPROPERTY('productversion'))) = 1
BEGIN
RAISERROR('Youc an only...
September 18, 2012 at 12:06 pm
Instead of using UDFs (dbo.get_BOY) that will reduce performance, try looking at this article.
http://www.sqlservercentral.com/blogs/lynnpettis/2009/03/25/some-common-date-routines/
September 18, 2012 at 11:45 am
Have you tried to google them?
The first result when I searched Northwind was https://www.microsoft.com/en-us/download/details.aspx?id=23654
It might be different for you since I'm using DuckDuckGo
September 18, 2012 at 11:37 am
I guess you can do this or several nested CASEs as you had on Excel.
CASE WHEN Type1 <> 'RFS' THEN Detail1
WHEN Type2 <> 'RFS' THEN...
September 18, 2012 at 9:42 am
CELKO (9/17/2012)
2 points here. First, What does an IDENTITY value do other than uniquely identify an entity?
Think of a parking garage (disk) and parking slot numbers (identity,...
September 18, 2012 at 8:19 am
Two options:
SELECT TotalDueForTheCurrentYear = SUM(CASE WHEN YEAR(OrderDate) = YEAR(GETDATE()) THEN TotalDue ELSE 0 END),
OverAllTotalDue = SUM(TotalDue)
FROM #TestBasedOnYear
SELECT TotalDueForTheCurrentYear = SUM(CASE WHEN OrderDate >= DATEADD( yyyy, DATEDIFF(yyyy,0,GETDATE()),...
September 18, 2012 at 7:18 am
I came out with the same code as Jeff showed in the article, but I believe that Scott's code would be better as it is a single table scan instead...
September 17, 2012 at 2:04 pm
Viewing 15 posts - 8,386 through 8,400 (of 8,731 total)