Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
employeeid  employee salaryheadid actualformula   formula     type    abb  rate         
----------- --------------------------------------------------------------------
96          rakesh    5            {1}-{2}      {Basic}-{Bus}  +      rajj  null


employeeid  salaryheadid abb                    rate
----------- ------------ ---------------------- ---------------------
96          1            Basic                  336.6667
96          2            Bus                    10.00



salaryheadid   abb
-------------- ----------
1              Basic
2              Bus
3              Other
4              TDS
5              rajj
6              tax
7              mmm


here is 3 tables in table 1 rate for employeeid=96 is null,.
i want to set its value= 336.6667 - 10 =326.6667.
the formula is coming from another tabel p_formula. it may be anything.
basic * bus or anything else.
can anyone plz help me.,.
plz give sol in asp with vb....

[edit]Code block added, title updated - OriginalGriff[/edit]
Posted
Updated 6-Oct-13 22:33pm
v3
Comments
OriginalGriff 7-Oct-13 4:33am    
Changed question title to meaningful description. Please do not use "please help me" or similar as it does not tell potential answerers what your problem is - that wastes time if they (in this case) know nothing about threading. If you use a more descriptive title, you will get better focussed responses.
rajveer344 7-Oct-13 4:35am    
ok

1 solution

If you mean that you have a text-based column in a different table that contains a list of expressions you could apply to the field, then you will need to read that into a string, and build a new SQL statement from it, then execute that. So if for example you had p_formula:
Id    Exp
1     rate-10
2     rate+10
3     rate*5
Then:
SQL
DECLARE @Cmd VARCHAR(MAX)
DECLARE @Exp VARCHAR(MAX)
SET @Exp = SELECT Exp FROM p_formula WHERE Id=1
SET @Cmd = 'UPDATE MyTable SET rate=''' + @EXP + ''' WHERE employeeID=96 AND abb=''Basic'''
Exec(@Cmd)
That probably won't do what you want exactly, but I don't fully understand your thinking here - it seems like a very odd way to do things, which means there is probably a much, much better way to get the result you want - but it gives you the general idea.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900