Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
roop
Starting Member
9 Posts |
Posted - 2007-09-11 : 03:05:00
|
| hi,i m facing a problem. I want to convert '%' into datetime format.can any one provide me solution?Thanx |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-09-11 : 03:09:24
|
What is % meant to represent? E 12°55'05.25"N 56°04'39.16" |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2007-09-11 : 03:33:20
|
| I'm guessing that the OP wants to do "wildcard" search on dates.If you are looking for, say, Month = February you can doSELECT *FROM MyTableWHERE DATEPART(Month, MyDateColumn) = 2Kristen |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-09-11 : 05:34:17
|
orSELECT *FROM MyTableWHERE DATENAME(Month, MyDateColumn) = 'February'provided language of the Server is English MadhivananFailing to plan is Planning to fail |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2007-09-11 : 05:45:38
|
orSELECT *FROM MyTableWHERE DATENAME(Month, MyDateColumn) LIKE 'Feb%'so not we have "%" in the query Kristen |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-09-11 : 05:50:32
|
quote: Originally posted by Kristen orSELECT *FROM MyTableWHERE DATENAME(Month, MyDateColumn) LIKE 'Feb%'so not we have "%" in the query Kristen
Clever MadhivananFailing to plan is Planning to fail |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2007-09-11 : 05:58:44
|
| Of course we could also do "When there is an R in the month":SELECT *FROM MyTableWHERE DATENAME(Month, MyDateColumn) LIKE '%[Rr]%'Kristen |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-09-11 : 06:02:09
|
quote: Originally posted by Kristen Of course we could also do "When there is an R in the month":SELECT *FROM MyTableWHERE DATENAME(Month, MyDateColumn) LIKE '%[Rr]%'Kristen
But not specific to February select * from(select '2005-02-01' as MyDateColumn union all select '2006-11-01') as TWHERE DATENAME(Month, MyDateColumn) LIKE '%[Rr]%'MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|