Click here to Skip to main content
15,949,741 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
SQL
use cms ALTER TABLE product ALTER COLUMN after_discount as ([pcost]*(1-[discount]))

error:
HTML
Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'as'.
Posted
Updated 6-Oct-12 8:27am
v2
Comments
Zoltán Zörgő 6-Oct-12 14:48pm    
Why don't you drop and than add the field? You have nothing to loose...

1 solution

I agree with Zoltán Zörgő.

Computed column cannot be altered
Instead use
ALTER TABLE [product] DROP COLUMN after_discount 
GO
ALTER TABLE [product] ADD after_discount as ([pcost]*(1-[discount]))


cheers
 
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