我想根据我的开发状态(b=backup,t=testing)写入不同的表。
显示问题的最小示例如下:
SELECT s.Monat FROM (
SELECT 'b' as mode, * FROM [BACKUP].IstMonat
UNION
SELECT 't' as mode, * FROM [TESTING].IstMonat
) s
where s.mode = 't' -- in the real world discovered by a sub query.
我怎样才能创建这样一个实际上可写的视图?
目前 ...
INSERT INTO TestView(Monat) VALUES (1);
... 结果是 ...
Msg 4406, Level 16, State 1, Line 1
Update or insert of view or function 'TestView' failed because it contains a derived or constant field.