SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Select Get Particular "Month" only
 New Topic  Reply to Topic
 Printer Friendly
Previous Page
Author Previous Topic Topic Next Topic
Page: of 2

cpriya
Starting Member

USA
1 Posts

Posted - 09/13/2007 :  18:37:07  Show Profile  Reply with Quote

Select saledate
from directtax
Where Month(cast(saledate as datetime)) in (11,12)

priya
Go to Top of Page

Kristen
Test

United Kingdom
22431 Posts

Posted - 09/13/2007 :  18:40:37  Show Profile  Reply with Quote
FWIW Casting String to Datetime, and then using a Month() function on the result will be slower than just doing a SUBTRING on it.

Plus any invalid dates will cause it to blow up!, whereas a String operation will be more forgiving.

Kristen
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

Sweden
30282 Posts

Posted - 09/13/2007 :  18:56:14  Show Profile  Visit SwePeso's Homepage  Reply with Quote
I thought we already have been through this.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Previous Page
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.07 seconds. Powered By: Snitz Forums 2000