Solved

Add calculating column to table in SQL 2008

Posted on 2011-09-09
3
298 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
  • 2
3 Comments
 
LVL 39

Accepted Solution

by:
lcohan earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
Perfect!!  Thanks!!
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

     When we have to pass multiple rows of data to SQL Server, the developers either have to send one row at a time or come up with other workarounds to meet requirements like using XML to pass data, which is complex and tedious to use. There is a …
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now