| | |
Default value of a column
Please support our MS SQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Nov 2005
Posts: 2
Reputation:
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
Posts: 483
Reputation:
Solved Threads: 19
I would go with the simpler computed column
MS SQL Syntax (Toggle Plain Text)
CREATE TABLE [TableName] ( [Column1Name] [int] IDENTITY (1, 1) NOT NULL , [Column2Name] [int] NULL , [Column3Name] AS ([Column1Name] + [Column2Name]) ) ON [PRIMARY] GO
![]() |
Similar Threads
- 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: new in sql world
- Next Thread: help with joins
Views: 16525 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for MS SQL
"last age autogrowth business connectingtodatabaseinuse count cursor data database dateadd datediff datepart day" dbsize deadlock delete_trigger exploit getdate hack highperformancecomputing hpc hpcserver2008 ibm iis limit live loop maximum microsoft ms mssql multiple multithreading news number password permission position query reporting result security server services sets single source sql sql-injection sqlserver sqlserver2005 subtype supercomputing supertype tables uniqueid update view weekday





