home
training courses
why choose us?
solutions
support
company
LearnItFirst User Forum
Welcome Guest
Search
|
New Posts
|
Members
|
Log In
|
Register
SQL Server Forum - LearnItFirst.com
»
Transact-SQL Programming
»
Stored Procedures, Triggers, & Functions
»
Getting value for (User Input/dynamic) column from table
Getting value for (User Input/dynamic) column from table
Options
Previous Topic
·
Next Topic
Laxmikant
Posted:
Saturday, March 06, 2010 11:57:08 PM
Rank: Newbie
Joined: 3/6/2010
Posts: 1
Points: 3
Where do you live?: India
I have two tables named IN_Heads, Emp.
IN_Heads has one column named Head_Desc with following values
Head_Desc
..................
Basic
DA
HRA
Emp table has following structure:
Emp_No :: BASIC :: DA :: HRA :: LTA :: Canteen
20 :: 4330 :: 340 :: 2763 :: 300 :: 0
21 :: 4000 :: 600 :: 2133 :: 500 :: 30
27 :: 7320 :: 100 :: 3163 :: 600 :: 60
23 :: 5690 :: 900 :: 4663 :: 100 :: 70
25 :: 8355 :: 150 :: 1563 :: 200 :: 0
Now my problem is I want to get from EMP table Addition of only those columns' values which are present under Head_Desc of table IN_Heads. (i.e. (Basic + DA + HRA) only, excluding LTA & CANTEEN as they dont appear in IN_Heads table). Values of Head_Desc may vary time to time.
I'm using stored procedures and user defined functions. I need to write a function for the above to get a single float value for given employee, say emp_no 21.
Any suggestion. Its urgent. Please.
Back to top
Scott Whigham
Posted:
Friday, March 12, 2010 5:16:03 AM
Rank: Super Mod
Joined: 3/20/2006
Posts: 460
Points: 1,002
Where do you live?: Dallas, TX
I'm sorry but I only half way understand your question.
Quote:
Now my problem is I want to get from EMP table Addition of only those columns' values which are present under Head_Desc of table IN_Heads. (i.e. (Basic + DA + HRA) only, excluding LTA & CANTEEN as they dont appear in IN_Heads table). Values of Head_Desc may vary time to time.
I don't get that at all - I'm lost on what you are asking.
Back to top
Users browsing this topic
Guest
Forum Jump
SQL Server Database Administration
- General SQL Database Question & Answer
- Backup, Recovery and Disaster Recovery
- SQL Server Security
- Integration Services (SSIS) and DTS
Transact-SQL Programming
- DML (SELECT, INSERT, UPDATE, DELETE) Questions
- Stored Procedures, Triggers, & Functions
SQL Server Scripts, Code Samples and SSMS Custom Reports
- All SQL Server Versions
- SQL Server 2005/2008
- SQL Server Management Studio Custom Reports
Customer Service
- Video Requests
You
cannot
post new topics in this forum.
You
cannot
reply to topics in this forum.
You
cannot
delete your posts in this forum.
You
cannot
edit your posts in this forum.
You
cannot
create polls in this forum.
You
cannot
vote in polls in this forum.
SQL Server 2005 DBA Training Videos
SQL Server 2008 DBA Training Videos
Watch this topic
RSS Feed
Email this topic
Print this topic
Threaded
Normal