Question: Sql Server- My query: select OrderID, ItemID, '$' + cast(price as varchar(10)), '$' + cast(price * .06 as varchar(10)) as [Sales Tax], '$' + cast(price

Sql Server-

My query:

select OrderID, ItemID, '$' + cast(price as varchar(10)), '$' + cast(price * .06 as varchar(10)) as [Sales Tax], '$' + cast(price * 1.06 as varchar(10)) as [Sub Total] from ORDER_ITEM

My results:

OrderID ItemID Sales Tax Sub Total ----------- ----------- ----------- ----------- ----------- 1004 1003 $15.50 $0.9300 $16.4300 1036 1046 $15.00 $0.9000 $15.9000 1036 1049 $20.00 $1.2000 $21.2000

How do I round the sales Tax and Subtotal Columns? I have tried to use the decimal instead of varchar and it will not allow the '$' then.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!