•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the MS SQL section within the Web Development category of DaniWeb, a massive community of 401,692 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,746 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Views: 8870 | Replies: 2
![]() |
•
•
Join Date: Nov 2005
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 0
PLs could somebody tell me how in MS SQL set the default value of a column as the sum of 2 columns
column3=column1+column2
where column3 is bigint
column1 and column2 are int
column1 is primary key with identity incresed by 1
if posibble column2 is a column from another table but the same db
Thanks a lot
column3=column1+column2
where column3 is bigint
column1 and column2 are int
column1 is primary key with identity incresed by 1
if posibble column2 is a column from another table but the same db
Thanks a lot
•
•
•
•
Originally Posted by gymanual
PLs could somebody tell me how in MS SQL set the default value of a column as the sum of 2 columns
column3=column1+column2
where column3 is bigint
column1 and column2 are int
column1 is primary key with identity incresed by 1
if posibble column2 is a column from another table but the same db
Thanks a lot
and dotn pass the value for field, so whever u will enter the row or alter it, the next field which is formula will be generated automatically,
if u r unknown for triggers then inform me
i will tell u ow to make triggers
•
•
Join Date: Jul 2005
Location: Dallas, TX
Posts: 481
Reputation:
Rep Power: 4
Solved Threads: 19
I would go with the simpler computed column
CREATE TABLE [TableName] ( [Column1Name] [int] IDENTITY (1, 1) NOT NULL , [Column2Name] [int] NULL , [Column3Name] AS ([Column1Name] + [Column2Name]) ) ON [PRIMARY] GO
![]() |
•
•
•
•
•
•
•
•
DaniWeb MS SQL Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Slow Page Loads in IE (Viruses, Spyware and other Nasties)
- HOWTO: Run a Query on a Database using ODBC and return all Results into a DGV Object (C#)
- Surf Sidekick has taken over my computer (Viruses, Spyware and other Nasties)
- Spyware Quake problem - help, please? (Viruses, Spyware and other Nasties)
- Adding and deleting a column in JTable (Java)
- Have you ever seen this before? (Viruses, Spyware and other Nasties)
- Help...symantec keeping sending email (Viruses, Spyware and other Nasties)
- I have the CachcaheKit virus and i need help (Viruses, Spyware and other Nasties)
- can't run ad-aware se (Viruses, Spyware and other Nasties)
- ListView Doubt ? (C)
Other Threads in the MS SQL Forum
- Previous Thread: datetime format in ms sql
- Next Thread: help with joins


Linear Mode