Viewing 15 posts - 76 through 90 (of 356 total)
Is your #dup_problem table the output that you are trying to generate (without the "duplicate" rows of course), or does it match the structure of your source data table?
If the...
August 13, 2010 at 4:15 pm
"WHERE (1 = 1)" is sometimes convenient when generating dynamic SQL.
It avoids having to determine if a particular filter criterion in the WHERE clause is the first in the...
August 13, 2010 at 3:48 pm
Try:
SELECT DATENAME(month, GETDATE()) + ' ' + DATENAME(day, GETDATE())
This also works in different languages:
SET LANGUAGE N'e???????' /* Greek */
SELECT DATENAME(month, GETDATE()) + ' ' + DATENAME(day, GETDATE())
July 29, 2010 at 4:56 pm
Nevyn,
Your query needs some fixing up to make it work. The left outer join is not having any filtering effect, so the query is just returning the Code for which...
July 29, 2010 at 4:24 pm
There are several ways of doing this, but here's an old-fashioned method.
I've assumed your table definition looks something like this:
CREATE TABLE Sequences (
ID int NOT NULL PRIMARY...
July 29, 2010 at 3:32 pm
In which case this amendment should fulfill your requirements:
SELECT TT.[Time] FROM TempTime TT
WHERE NOT EXISTS (
SELECT * FROM FlowTimesheet F1
...
June 18, 2010 at 4:22 am
Given your test data, if I understand you correctly, there are only two contiguous time intervals in the 24-hour period where the Active flag was set (=1) between consecutive FlowTimesheet...
June 16, 2010 at 1:37 pm
There's a relatively common pitfall that you can encounter when converting the old-style (*= / =*) outer join syntax to the LEFT / RIGHT OUTER JOIN syntax. This occurs when...
January 8, 2010 at 9:56 am
I don't think Jason's query will work.
This might not either as I haven't tested it.
;WITH cteVisit AS (
SELECT
MemberID,
...
December 18, 2009 at 3:33 pm
OK, I've made the assumption that your table structure is something like the following:
CREATE TABLE #TEST_FOR_XML (
id int PRIMARY KEY,
C_Comment varchar(100),
i_number...
November 26, 2009 at 9:16 pm
Can you provide your source data table structure TEST_FOR_XML and some test data in a readily consumable form, i.e. as insert statements.
Are you sure you need the CDATA section? If...
November 26, 2009 at 8:55 pm
My query gives the following results, where the single entry for CID=1001 returns the visit date 2009-03-03 rather than 2009-02-23, but I believe that it returns what you want.
CID ...
October 31, 2009 at 6:49 am
Thanks for supplying the test data. However, your expected results seem to be slightly inconsistent with your described requirements. Is it the first or the second date of a pair...
October 31, 2009 at 6:26 am
If I understand your cursor code correctly, then the following 2 statements will do the equivalent. The self join on the ll_dup_sender table is effectvely creating a map linking duplicate...
October 23, 2009 at 12:40 pm
The trouble with DATEPART is that it depends on the value of @@DATEFIRST.
The value of this expression:
DATEDIFF(day, '17530101', @TestDate) % 7 + 1
will always be 5 if the value of...
October 20, 2009 at 8:09 am
Viewing 15 posts - 76 through 90 (of 356 total)