KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Here is my situation: In my table i two fields: - Price (decimal (15,4) - TaxId (int) TaxId value is not stored anywhere but there are only two values (actualy 3). - 1 (8.5%) - 2 (20%) - NULL (no tax) Now i need calculated column in my view that would calculate new price with tax included. Any idea? I went with something like: SELECT... CASE TaxId WHEN 1 THEN Price *1.085 AS test WHEN 2 THEN Price *1.2 AS test WHEN NULL THEN Price AS test END FROM... UPDATE: I have managed to execute the query with success. CASE dbo.Table.TaxId WHEN 1 THEN dbo.Table.Price*1.085 WHEN 2 THEN dbo.Table.Price*1.2 ELSE dbo.Table.Price END AS CalcualtedPrice Now I only need to make CalculatedPrice as decimal (15,4). How can i set that?
Tags (comma-separated)
Save Edits
Cancel