我正在处理一个视图,然后由用户更新。此更新基本上更改了列的值。但现在它不允许我这样做并产生这个:
Update or insert of view or function '' failed because it contains a derived or constant field.
Run Code Online (Sandbox Code Playgroud)
我知道这是因为我在 select 语句中有一个常量,但是有没有办法绕过它?请帮忙
这是我的视图代码
Create view Schema.View1
as
SELECT
Convert(Varchar(20),l.jtpName) as JobType, Convert(Varchar(10),' <All> ')as SubCategory , Convert(varchar (3), Case when a.jtpName= l.jtpName and a.subName= ' <All> ' then 'Yes' else 'No' end) As AutoProcess from Schema.JobType l left join Schema.Table1 a on l.jtpName=a.jtpName
UNION
SELECT
Convert(Varchar(20),a.jtpName) as JobType, Convert(Varchar(10),a.subName) as SubCategory, Convert(varchar (3),Case when b.jtpName= a.jtpName and b.subName= a.subName then 'Yes' …Run Code Online (Sandbox Code Playgroud)