将ALTER COLUMN更改为计算的列错误 [英] ALTER COLUMN to a computed column error

查看:65
本文介绍了将ALTER COLUMN更改为计算的列错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

use cms ALTER TABLE product ALTER COLUMN after_discount as ([pcost]*(1-[discount]))


错误:


error:

Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'as'.

推荐答案

我同意ZoltánZörgő.

计算列不能更改
而是使用
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


这篇关于将ALTER COLUMN更改为计算的列错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆