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 |
|
g3jimha
Starting Member
10 Posts |
Posted - 2011-07-05 : 05:53:45
|
| Hi there I was wondering if there was any way to make a column which I can put a date in (5/7/2011) or "NR" for not required?thanks, Jim :) |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2011-07-05 : 05:58:20
|
varchar(8)But then you have to convert the values ... No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2011-07-05 : 07:09:33
|
I know I shouldn't lecture, but I can't help!! It is a very bad idea to put a date and a non-date (such as NR) in the same column. Make the column a DATE or DATETIME data type and consider using NULL values to indicate NR. Or, add another column to indicate whether the value in the date column should be NR, or even some other status.There are several reasons why you don't want to mix dates and non-dates in the same column - take a look at Joe Celko's reponse in this thread: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=160334 (Overlook the "serious" manner in which he writes the response but he is making very valid arguments) |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2011-07-05 : 09:16:25
|
| Always use proper DATETIME datatype to store dates and do formation in the front end applicationMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|