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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-08-23 : 10:01:28
|
| abhishek writes "while creating table i want to include only date data typein my table i don't want to use datetime data typehow can i do that like for e.g in datetime data type there is a function in sql-server7.0 getdate()what's there for date data type.pls reply me as soon as posible" |
|
|
Onamuji
Aged Yak Warrior
504 Posts |
Posted - 2002-08-23 : 10:17:23
|
| um use SMALLDATETIME if you don't need to worry about time precision ... it still stores time info but you can ignore it in your queries if all you want is the date ... when you do inserts into the table just use something like this to keep all your dates with times of 00:00:00.000 so they can match each other and whatever you want to do...DECLARE @dateToInsert DATETIMESET @dateToInsert = GETDATE() ' This will return time informationSET @dateToInsert = CONVERT(CONVERT(@dateToInsert, VARCHAR, 101) + ' 00:00:00', DATETIME)That should make it set to midnight of that day ... may need to change 101 in the inner convert to match your regional settings thats just the value i use for MM/DD/YYYY ... hope this helps a little... |
 |
|
|
dsdeming
479 Posts |
Posted - 2002-08-23 : 10:17:42
|
| SQL Server has no date datatype. If datetime won't work for you, you'll have to create a char or varchar column to hold the date strings. That means the code in you application will have to handle all of the conversions which could quickly become tedious. |
 |
|
|
|
|
|