I'm on SQL Server 2000.
I have a view Statistics
containing an UNION ALL with 5 different tables (but with the exactly same structure) in different databases:
SELECT *
FROM statistics_01.dbo.Stat
UNION ALL
SELECT *
FROM statistics_02.dbo.Stat
UNION ALL
SELECT *
FROM statistics_03.dbo.Stat
UNION ALL
SELECT *
FROM statistics_04.dbo.Stat
UNION ALL
SELECT *
FROM statistics_05.dbo.Stat
This view is used to facilitate updates in the different tables.
The primary key of the tables is the following:
[Date] [char](8) NOT NULL,
[Store] [int] NOT NULL,
[EAN] [char](14) NOT NULL,
Each table has a different constraint based on the Date:
- statistics_01.dbo.Stat, Constraint ([Date] >= '20100101' and [Date] <= '20101231')
- statistics_02.dbo.Stat, Constraint ([Date] >= '20110101' and [Date] <= '20111231')
- statistics_03.dbo.Stat, Constraint ([Date] >= '20120101' and [Date] <= '20121231')
- statistics_04.dbo.Stat, Constraint ([Date] >= '20130101' and [Date] <= '20131231')
- statistics_05.dbo.Stat, Constraint ([Date] >= '20140101' and [Date] <= '20141231')
So when an insert is done by the view, depending on the date the insertion is done in the right table.
But the problem is that since i created the DB statistics_05
and table Stat
and added that new table in the view, i always get the following message.
Msg 4416, Sev 16:
UNION ALL viewStatistics
is not updatable because the definition contains a disallowed construct. [SQLSTATE 42000]
P.S: I already tried to replace the *
with all the columns without success...
Thank you for your help
I found the problem, it was due to a different ANSI_PADDING
for the newly created table statistics_05.dbo.Stat.
The others table of the view had a ANSI_PADDING
SET on ON, and the last table was created with a ANSI_PADDING
set on OFF.