Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Error in partition views

Author  Topic 

VipinMitta
Starting Member

12 Posts

Posted - 2009-06-30 : 05:33:09
hi all,

i create following tables and view but when i trying to insert data into view... it gives following error.


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



--------- create 1st table-------
CREATE TABLE [dbo].[TBL_CURRENT](
[TRAN_CODE] [varchar](12) NOT NULL CONSTRAINT [DF_TBL_CURRENT_TRAN_CODE] DEFAULT (0),
[TR_DATE] [datetime] NULL,
[ID_NO] [bigint] IDENTITY(500000000000,1) NOT NULL,
CONSTRAINT [PK_TBL_CURRENT_TRAN_CODE] PRIMARY KEY NONCLUSTERED
(
[TRAN_CODE] ASC)
)


ALTER TABLE [dbo].[TBL_CURRENT] WITH CHECK
ADD CONSTRAINT [CHK_TBL_CURRENT_TRDATE] CHECK (([TR_DATE] >= '20080101'))


--------- create 2nd table-------
CREATE TABLE [dbo].[TBL_2008](
[TRAN_CODE] [varchar](12) NOT NULL CONSTRAINT [DF_TBL_2008_TRAN_CODE] DEFAULT (0),
[TR_DATE] [datetime] NULL,
[ID_NO] [bigint] IDENTITY(500000000000,1) NOT NULL,
CONSTRAINT [PK_TBL_2008_TRAN_CODE] PRIMARY KEY NONCLUSTERED
(
[TRAN_CODE] ASC
)
)


ALTER TABLE [dbo].[TBL_2008] WITH CHECK ADD CONSTRAINT [CHK_TBL_2008_TRDATE]
CHECK (([TR_DATE] >= '20060101' and [TR_DATE] < '20080101'))


--------------------creating view--------------

CREATE VIEW [dbo].[VIEWTRAN]
as

SELECT * from TBL_CURRENT
union all
SELECT * from TBL_2008







any help appriciated


SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-06-30 : 06:25:48
See http://weblogs.sqlteam.com/peterl/archive/2007/09/24/Horizontal-partitioning.aspx


N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

pmotewar
Yak Posting Veteran

62 Posts

Posted - 2009-06-30 : 07:07:28
hi peso,
what are the advantages of the partitioning.




quote:
Originally posted by Peso

See http://weblogs.sqlteam.com/peterl/archive/2007/09/24/Horizontal-partitioning.aspx


N 56°04'39.26"
E 12°55'05.63"




Pankaj
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-06-30 : 13:42:42
http://www.c-sharpcorner.com/UploadFile/DipalChoksi/partn_sql2005_dc11162006213927PM/partn_sql2005_dc.aspx
Go to Top of Page
   

- Advertisement -