October 24, 2015 at 2:37 pm
Phil Parkin (10/24/2015)
Why use DATEPART(), when you can use YEAR() for this?
Yeah, why am I not using the Year Function.
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
October 25, 2015 at 11:12 am
Welsh Corgi (10/23/2015)
Lynn Pettis (10/23/2015)
Something like this?
SELECT
DATEPART(yyyy,tc.Call_Date) AS ArchiverYear
FROM
dbo.tblCall tc
INNER JOIN PrismDataArchive.dbo.ArchiveDriver AS Arch
ON Arch.ArchiveYear = DATEPART(yyyy,tc.Call_Date);
That worked perfectly Lynn.
Thanks.:-)
Which table is the larger for the code above? I suspect that it's the dbo.tblCall table but need to know for sure before I make a recommendation.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 2 posts - 16 through 17 (of 17 total)
You must be logged in to reply to this topic. Login to reply