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 |
|
openlix
Starting Member
1 Post |
Posted - 2009-10-12 : 17:58:28
|
| I'm creating records to a file with fields datetime.When I create, I don't want any values in the fields datatime but SQL Server assign 01/01/1900. I don't want it. How can I avoid that ?If you have the answer, well I have another one. The ERP we are using save only the date, not the time, in the datetime fields. I don;t have the source code because I would like to know how to do that.Any idea ? |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
lazerath
Constraint Violating Yak Guru
343 Posts |
Posted - 2009-10-13 : 14:15:16
|
| It's pretty easy to store a DATETIME but return just a date (just replace GETDATE() with your column name):[CODE]SELECT CONVERT(VARCHAR(10),GETDATE(),101)10/13/2009(1 row(s) affected)[/CODE]or time:[CODE]SELECT CONVERT(VARCHAR(36),GETDATE(),108)13:12:05(1 row(s) affected)SELECT CONVERT(VARCHAR(36),GETDATE(),114)13:14:14:063(1 row(s) affected)[/CODE] |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|
|
|
|
|