[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 218
  • Last Modified:

T-SQL Column Default

Hi,
I'd like to set the default value of a column in a table equal to the value of another column in the same table.  This is a temporary vlue until it get's updated later.  I need the column to be unique, so this is why I am setting it equal to the key value initially.

How do I indicate this default (if possible).  I can do it programatically on the insert.

FYI.  I'm using MS SQL Server 2005

Thanks, in advance,
hefterr
0
hefterr
Asked:
hefterr
2 Solutions
 
chapmandewCommented:
You can't set a default to the value of a different column.
0
 
Aneesh RetnakaranDatabase AdministratorCommented:
the only way to do that is to create a trigger, which i wont prefer for a highly transactional system
0
 
hefterrAuthor Commented:
Ok Thanks - I'll handle it in the program doing the initial INSERT.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now