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)
 Default value set to column

Author  Topic 

X-Factor
Constraint Violating Yak Guru

392 Posts

Posted - 2004-07-08 : 09:10:30
Hi,

How do I have a column's default value be the value from a different column in the row?

Cheers,

X.Factor

JimL
SQL Slinging Yak Ranger

1537 Posts

Posted - 2004-07-08 : 09:36:53
I do this on one table with a trigger.

On Insert

Select

CollA = Case when CollA Is null
Then CollB
Else CollA
end
From Table

Jim
Users <> Logic
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2004-07-08 : 11:46:30
Dunno if its more efficient, but my style for this is:

...
CollA = COALESCE(CollA, CollB)
...
Go to Top of Page
   

- Advertisement -