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 |
|
csphard
Posting Yak Master
113 Posts |
Posted - 2005-12-08 : 13:14:18
|
| I have a field that is define as varchar(10). I want to do a datepart on it and I get an error. How do I convert that field in sql to a date so that I can do a datepart against it.Below is the sql statementselect * from test where datepart(yyyy,appt_stop_date) < '1965' |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
csphard
Posting Yak Master
113 Posts |
Posted - 2005-12-08 : 17:02:29
|
| thanks that worked. I appreciate it |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-12-09 : 01:36:16
|
| Hereafter use Proper DateTime Datatype to avoid this difficultyMadhivananFailing to plan is Planning to fail |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2005-12-09 : 02:15:42
|
| I'm with you Maddy ..."I have a [date] field that is define as varchar(10)"I'd love to know whyKristen |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2005-12-09 : 02:23:31
|
I have seen too many similar cases.Looking at a table"Who is the stupid programmer that keep date time in a varchar ? How can anybody design such a table.... this is rediculus"Few minutes later after tracing and found out who is the "stupid programmer""Oh It's me .I must have done that when i am still new to SQL"It happned too many times   -----------------[KH]Where Am I ? |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2005-12-09 : 23:50:56
|
"Oh It's me .I must have done that when i am was still new to SQL"Sorry, but you just can't use that old excuse anymore Kristen |
 |
|
|
|
|
|