?
Solved

Add calculating column to table in SQL 2008

Posted on 2011-09-09
3
Medium Priority
?
308 Views
Last Modified: 2012-05-12
How can I add a calculating column to an existing table in sql 2008??

I know how to design and how to insert a column and name it.

Now I want it to take a number in the column called inspection_sample_breakdown_rock_dirt_foreign_material_percent
and multiply it by the number in a column called
contract_information_total_weight

Any help with this??
0
Comment
Question by:HDM
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 40

Accepted Solution

by:
lcohan earned 2000 total points
ID: 36513742
That would be somethinmg like:

ALTER TABLE dbo.TableName
ADD new_column_name AS inspection_sample_breakdown_rock_dirt_foreign_material_percent*contract_information_total_weight

0
 

Author Comment

by:HDM
ID: 36513774
I am assuming I would need to change the inspection_sample_breakdown_rock_dirt_foreign_material_percent data type to an int??
0
 

Author Closing Comment

by:HDM
ID: 36513988
Perfect!!  Thanks!!
0

Featured Post

How Blockchain Is Impacting Every Industry

Blockchain expert Alex Tapscott talks to Acronis VP Frank Jablonski about this revolutionary technology and how it's making inroads into other industries and facets of everyday life.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question