Solved

Add calculating column to table in SQL 2008

Posted on 2011-09-09
3
306 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 500 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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Suggested Solutions

There have been several questions about Large Transaction Log Files in SQL Server 2008, and how to get rid of them when disk space has become critical. This article will explain how to disable full recovery and implement simple recovery that carries…
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 a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

733 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