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
 Transact-SQL (2000)
 Use inserted data in default for different column

Author  Topic 

rpieszak
Starting Member

11 Posts

Posted - 2005-04-01 : 13:48:29
Greetings all,

I would like to accomplish the following: when I insert a record that contains a timestamp, and I would like the default value of a different column to be DatePart(yy,timestamp).

Is this possible?
Thanks,
Ryan

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-04-01 : 13:52:57
Yes. But why not just tell it to do that on the insert?

Tara
Go to Top of Page

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2005-04-01 : 14:23:10
Or you make a calculated column;

create table #a( ts datetime not null, b as(datepart(yy,ts)))
insert #a(ts) select getdate()
select * from #a

rockmoose
Go to Top of Page
   

- Advertisement -