dbTalk Databases Forums  

Help on Partitioning column was not found.

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss Help on Partitioning column was not found. in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Sonny
 
Posts: n/a

Default Help on Partitioning column was not found. - 05-31-2007 , 04:11 PM






Hi,

I don't know if I missed anything. I have 2 member tables and one
partition view in SQL 2000 defined as following

CREATE VIEW Server1.dbo.UTable
AS
SELECT *
FROM Server1..pTable1
UNION ALL
SELECT *
FROM Server2..pTable2

CREATE TABLE pTable1 (
[ID1] [int] IDENTITY (1000, 2) NOT NULL ,
[ID2] [int] NOT NULL ,

...<other columns>.........

CONSTRAINT [PK_tblLot] PRIMARY KEY CLUSTERED
(
[ID1],
[ID2]
) ON [PRIMARY] ,
CHECK ([ID2] = 1015)
) ON [PRIMARY]


CREATE TABLE [pTable2] (
[ID1] [int] IDENTITY (1001, 2) NOT NULL ,
[ID2] [int] NOT NULL ,

...<other columns>.........

CONSTRAINT [PK_tblLot] PRIMARY KEY NONCLUSTERED
(
[ID1],
[ID2]
) WITH FILLFACTOR = 90 ON [PRIMARY] ,
CHECK ([ID2] <> 1015)
) ON [PRIMARY]


SELECT is working fine. However, I got error message if I issue an
update command such as

UPDATE UTable
SET somecol = someval
Where somecol2 = somecond

Server: Msg 4436, Level 16, State 12, Line 1
UNION ALL view 'UTable' is not updatable because a partitioning column
was not found.

Anyone have any idea? ID2 is my partition column, why the SQL 2K
doesn't see it. It is a part of primary key, having checking
constrain, and no other constrain on it. Am I missing something?

Thanks a lot.


Reply With Quote
  #2  
Old   
Tom Moreau
 
Posts: n/a

Default Re: Help on Partitioning column was not found. - 05-31-2007 , 04:17 PM






You cannot have identity columns in an updatable partitioned view.

--
Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau


"Sonny" <SonnyKMI (AT) gmail (DOT) com> wrote

Hi,

I don't know if I missed anything. I have 2 member tables and one
partition view in SQL 2000 defined as following

CREATE VIEW Server1.dbo.UTable
AS
SELECT *
FROM Server1..pTable1
UNION ALL
SELECT *
FROM Server2..pTable2

CREATE TABLE pTable1 (
[ID1] [int] IDENTITY (1000, 2) NOT NULL ,
[ID2] [int] NOT NULL ,

....<other columns>.........

CONSTRAINT [PK_tblLot] PRIMARY KEY CLUSTERED
(
[ID1],
[ID2]
) ON [PRIMARY] ,
CHECK ([ID2] = 1015)
) ON [PRIMARY]


CREATE TABLE [pTable2] (
[ID1] [int] IDENTITY (1001, 2) NOT NULL ,
[ID2] [int] NOT NULL ,

....<other columns>.........

CONSTRAINT [PK_tblLot] PRIMARY KEY NONCLUSTERED
(
[ID1],
[ID2]
) WITH FILLFACTOR = 90 ON [PRIMARY] ,
CHECK ([ID2] <> 1015)
) ON [PRIMARY]


SELECT is working fine. However, I got error message if I issue an
update command such as

UPDATE UTable
SET somecol = someval
Where somecol2 = somecond

Server: Msg 4436, Level 16, State 12, Line 1
UNION ALL view 'UTable' is not updatable because a partitioning column
was not found.

Anyone have any idea? ID2 is my partition column, why the SQL 2K
doesn't see it. It is a part of primary key, having checking
constrain, and no other constrain on it. Am I missing something?

Thanks a lot.


Reply With Quote
  #3  
Old   
Sonny
 
Posts: n/a

Default Re: Help on Partitioning column was not found. - 05-31-2007 , 04:32 PM



On May 31, 4:17 pm, "Tom Moreau" <t... (AT) dont (DOT) spam.me.cips.ca> wrote:
Quote:
You cannot have identity columns in an updatable partitioned view.

--
Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canadahttps://mvp.support.microsoft.com/profile/Tom.Moreau

In that case, how should I deal with the ID1? I need that column to
be an identity column. Thanks.



Reply With Quote
  #4  
Old   
Tom Moreau
 
Posts: n/a

Default Re: Help on Partitioning column was not found. - 05-31-2007 , 04:40 PM



Consider putting an INSTEAD OF trigger on the partitioned view.

--
Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau


"Sonny" <SonnyKMI (AT) gmail (DOT) com> wrote

On May 31, 4:17 pm, "Tom Moreau" <t... (AT) dont (DOT) spam.me.cips.ca> wrote:
Quote:
You cannot have identity columns in an updatable partitioned view.

--
Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canadahttps://mvp.support.microsoft.com/profile/Tom.Moreau

In that case, how should I deal with the ID1? I need that column to
be an identity column. Thanks.



Reply With Quote
  #5  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: Help on Partitioning column was not found. - 05-31-2007 , 04:56 PM



Sonny (SonnyKMI (AT) gmail (DOT) com) writes:
Quote:
Anyone have any idea? ID2 is my partition column, why the SQL 2K
doesn't see it. It is a part of primary key, having checking
constrain, and no other constrain on it. Am I missing something?
Yes, <> is not a permitted operator. You need to rewrite

CHECK ([ID2] <> 1015)

to

CHECK ([ID2] < 1015 OR [ID2] > 1015)

Another story is whether this view will be very efficient. You should
probably add an index on ID2, or put it first in the primary key.


--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx


Reply With Quote
  #6  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: Help on Partitioning column was not found. - 05-31-2007 , 04:58 PM



Sonny (SonnyKMI (AT) gmail (DOT) com) writes:
Quote:
In that case, how should I deal with the ID1? I need that column to
be an identity column. Thanks.
Oh, I should have added the the IDENTITY appears to work fine, as soon
as I had changed the CHECK constraint.


--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx


Reply With Quote
  #7  
Old   
Sonny
 
Posts: n/a

Default Re: Help on Partitioning column was not found. - 06-01-2007 , 08:08 AM



On May 31, 4:58 pm, Erland Sommarskog <esq... (AT) sommarskog (DOT) se> wrote:
Quote:
Sonny (Sonny... (AT) gmail (DOT) com) writes:
In that case, how should I deal with the ID1? I need that column to
be an identity column. Thanks.

Oh, I should have added the the IDENTITY appears to work fine, as soon
as I had changed the CHECK constraint.

--
Erland Sommarskog, SQL Server MVP, esq... (AT) sommarskog (DOT) se

Books Online for SQL Server 2005 athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books...
Books Online for SQL Server 2000 athttp://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Thanks for all your help. I changed CHECK constraint, and now it is
not complaining about missing partition column anymore, however, when
do the Update or Insert it gives out Server: Msg 4450, Level 16, State
1, Line 1
Cannot update partitioned view 'UTable' because the definition of the
view column 'ID1' in table '[pTable1]' has a IDENTITY constraint. So
I think IDENTITY is the another issue. As Tom mentioned in his post,
using INSTEAD OF trigger, would anyone please give me an example,
never used before.

Again, thank you very much for your help.



Reply With Quote
  #8  
Old   
Tom Moreau
 
Posts: n/a

Default Re: Help on Partitioning column was not found. - 06-01-2007 , 08:12 AM



Check out:

http://msdn2.microsoft.com/en-us/lib...8(SQL.80).aspx

--
Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau


"Sonny" <SonnyKMI (AT) gmail (DOT) com> wrote

On May 31, 4:58 pm, Erland Sommarskog <esq... (AT) sommarskog (DOT) se> wrote:
Quote:
Sonny (Sonny... (AT) gmail (DOT) com) writes:
In that case, how should I deal with the ID1? I need that column to
be an identity column. Thanks.

Oh, I should have added the the IDENTITY appears to work fine, as soon
as I had changed the CHECK constraint.

--
Erland Sommarskog, SQL Server MVP, esq... (AT) sommarskog (DOT) se

Books Online for SQL Server 2005
athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books...
Books Online for SQL Server 2000
athttp://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Thanks for all your help. I changed CHECK constraint, and now it is
not complaining about missing partition column anymore, however, when
do the Update or Insert it gives out Server: Msg 4450, Level 16, State
1, Line 1
Cannot update partitioned view 'UTable' because the definition of the
view column 'ID1' in table '[pTable1]' has a IDENTITY constraint. So
I think IDENTITY is the another issue. As Tom mentioned in his post,
using INSTEAD OF trigger, would anyone please give me an example,
never used before.

Again, thank you very much for your help.



Reply With Quote
  #9  
Old   
Sonny
 
Posts: n/a

Default Re: Help on Partitioning column was not found. - 06-01-2007 , 08:22 AM



On Jun 1, 8:12 am, "Tom Moreau" <t... (AT) dont (DOT) spam.me.cips.ca> wrote:
Quote:
Check out:

http://msdn2.microsoft.com/en-us/lib...8(SQL.80).aspx

--
Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canadahttps://mvp.support.microsoft.com/profile/Tom.Moreau

"Sonny" <Sonny... (AT) gmail (DOT) com> wrote in message

news:1180703291.252760.209290 (AT) a26g2000pre (DOT) googlegroups.com...
On May 31, 4:58 pm, Erland Sommarskog <esq... (AT) sommarskog (DOT) se> wrote:

Sonny (Sonny... (AT) gmail (DOT) com) writes:
In that case, how should I deal with the ID1? I need that column to
be an identity column. Thanks.

Oh, I should have added the the IDENTITY appears to work fine, as soon
as I had changed the CHECK constraint.

--
Erland Sommarskog, SQL Server MVP, esq... (AT) sommarskog (DOT) se

Books Online for SQL Server 2005
athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books...
Books Online for SQL Server 2000
athttp://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

Thanks for all your help. I changed CHECK constraint, and now it is
not complaining about missing partition column anymore, however, when
do the Update or Insert it gives out Server: Msg 4450, Level 16, State
1, Line 1
Cannot update partitioned view 'UTable' because the definition of the
view column 'ID1' in table '[pTable1]' has a IDENTITY constraint. So
I think IDENTITY is the another issue. As Tom mentioned in his post,
using INSTEAD OF trigger, would anyone please give me an example,
never used before.

Again, thank you very much for your help.
Thank you so much!!



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.