Viewing 15 posts - 16 through 30 (of 31 total)
The third query is wrong:
DATEDIFF(yy, DateOfBirth, GETDATE()) - CASE WHEN DATEPART(m, DateOfBirth) >= DATEPART(m, GETDATE()) AND DATEPART(d, DateOfBirth) >= DATEPART(d, GETDATE()) THEN 0 ELSE 1 END
It instead should be:
DATEDIFF(yy,...
March 6, 2008 at 8:30 am
All (especially Ralph):
There are three JOIN clauses and only two ON clauses. Each JOIN clause should have a corresponding ON clause.
Again, good luck all!!!!
March 4, 2008 at 10:25 am
1) Assuming RecordedCalls is the table with 10 million records, and given this table has a DateTime column (CallDate) that you're filtering on in your WHERE clause, why don't...
March 4, 2008 at 8:56 am
How do I download import.zip and extract.zip? I need to see the .bat files, not just the VB6 code files.
Thanks,
--Jeff
October 9, 2007 at 8:09 am
Instead of using a subquery, an easier solution is:
SELECT E.LastName + ', ' + E.FirstName AS [Employee Name], COUNT(O.EmployeeID) [# of Orders]
FROM dbo.Employees E LEFT JOIN dbo.Orders O ON (E.EmployeeID...
July 29, 2006 at 10:01 am
govinn:
Good catch. I didn't unit test the solution first. Without writing a subquery, you need to include the item you want to sort by in the SELECT statement also. Therefore, the...
June 6, 2005 at 2:10 pm
Actually the correct solution to Alex's original question is:
SELECT distinct datename(mm, events.date) as Months
FROM Events
where datepart(month, events.date) between 5 and 6
order by charindex(left(datename(mm,events.date),3),'JanFebMarAprMayJunJulAugSepOctNovDec')
June 5, 2005 at 5:43 pm
Joe's answer is close to correct, but it has a small error in it. He should be using the DATENAME function instead of DATEPART. Also, the DATENAME function returns the...
June 5, 2005 at 5:37 pm
Remi:
I agree with you that there are many ways to "skin a cat". Here is another, related solution.
User Defined Function for Support
CREATE dbo.fnCountDelimiters(@sInput varchar(8000), @sDelimiter varchar(1))
RETURNS int
AS
BEGIN
DECLARE @iCount int,...
June 2, 2005 at 5:35 pm
Remi:
I agree that it would be nice if we could construct a static query and just pass in a delimited string to represent the list of keywords.
Unfortuncately, I still don't...
June 2, 2005 at 12:48 pm
OOPS!!!!!!!!!!!!
My mind went blank! Ignore the above "simple solution".
Unfortunately, the only way to solve this using my technique with derived tables is to use VB.NET or C# to construct a...
June 2, 2005 at 12:19 pm
Remi:
Thanks for the reply. I just thought of a much simpler solution that involves the use of a trivial user defined function (UDF).
Here is the UDF:
CREATE FUNCTION dbo.fnCountKeywords(@KeywordID int)
RETURNS int
AS
BEGIN
DECLARE @Count...
June 2, 2005 at 12:10 pm
This is an interesting problem. I think I have a better solution. Your solution only finds proposals that have KeywordID of 12 and 23 exactly, and no other keywords are...
June 2, 2005 at 11:02 am
Ling Ming:
What error message are you getting from the debugger on the line:
For Each idx in tbl.Indexes
Also, can you see other properties for tbl in the Immediate window (e.g. tbl.Name,...
May 27, 2005 at 8:55 am
1) For the VB code, you need to reference ADODB (e.g. Microsoft ActiveX Data Objects 2.7 Library) and ADOX (e.g. Microsoft ADO Ext 2.7 for DDL and Security). Here is...
May 26, 2005 at 11:29 am
Viewing 15 posts - 16 through 30 (of 31 total)