Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsDatabasesMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old March 24th, 2011, 10:54 AM
syedejaz syedejaz is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2011
Posts: 1 syedejaz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 22 m 9 sec
Reputation Power: 0
Storing calculation in a column

I am new to SQL server. I have university project. I dont have good idea in SQL.

I have a table EmployeeSalary.
I have the following columns:
[SalID]
,[EmpID]
,[MonthYear]
,[BassicSalary]
,[Housing]
,[Bonus]
,[Commision]
,[NetSalary]
,[Remarks]

I want a function which should store all the values of the columns [BassicSalary] ,[Housing] ,[Bonus]
,[Commision] in a column [NetSalary]
It should be like that
[NetSalary] = [BassicSalary]+[Housing]+[Bonus]+[Commision]
Kindly tell me how can I do it in SQL SERVER 2008.
Thanks

Reply With Quote
  #2  
Old March 25th, 2011, 09:37 PM
Ray Newman Ray Newman is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2011
Location: Dunwoody, GA
Posts: 7 Ray Newman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 49 m 6 sec
Reputation Power: 0
Quote:
Originally Posted by syedejaz
I am new to SQL server. I have university project. I dont have good idea in SQL.

I have a table EmployeeSalary.
I have the following columns:
[SalID]
,[EmpID]
,[MonthYear]
,[BassicSalary]
,[Housing]
,[Bonus]
,[Commision]
,[NetSalary]
,[Remarks]

I want a function which should store all the values of the columns [BassicSalary] ,[Housing] ,[Bonus]
,[Commision] in a column [NetSalary]
It should be like that
[NetSalary] = [BassicSalary]+[Housing]+[Bonus]+[Commision]
Kindly tell me how can I do it in SQL SERVER 2008.
Thanks


Tell me a little more. Are you looking for the syntax needed to update the NetSalary column, or are you looking for how to write an insert/update trigger to automatically update the NetSalary column when any of the other columns change?

Ray

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft SQL Server > Storing calculation in a column


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap