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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Auto increment date

Author  Topic 

Hommer
Aged Yak Warrior

808 Posts

Posted - 2004-11-10 : 10:28:22
I need a column with data looks like: 11/10/2004 7:00:00 AM. The mm/dd/yyyy part should "auto increment" itself as the current GetDate(), and the rest of it is constant for now. But may come from user input in the future.

The data type I used is smalldatetime. When I set its default = GetDate() + '7:00', that is only good when an insert happens. I think I need some kind of trigger, and then it will be a select trigger. It seems there is no such thing.

I appreciate any help!

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2004-11-10 : 10:29:41
I don't think you want to store the date in the table, you just wish to return the current date in your SELECT statement?

like this?

SELECT *, getdate() as CurrentDate
FROM YourTable

??

- Jeff
Go to Top of Page

Hommer
Aged Yak Warrior

808 Posts

Posted - 2004-11-10 : 10:50:55
That is a great idea!
Go to Top of Page
   

- Advertisement -