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)
 900 bytes size limitation

Author  Topic 

ravish1179
Starting Member

3 Posts

Posted - 2011-01-13 : 03:43:18
I have a table where I have 8 key columns and when I try to insert a record which has a size more than 900 bytes then insertion fails. I am trying to find out a solution for that so that I can enter a data of more than 900 bytes but could not found any solution.
Table structure is given as below:
CREATE TABLE [dbo].[TMUT_MUSHTRI](
[VILLAGE_ID] [uniqueidentifier] NOT NULL,
[KHEWAT_NO] [nvarchar](4000) NOT NULL,
[khatouni_no] [nvarchar](4000) NOT NULL,
[MUTATION_NUMBER] [bigint] NOT NULL,
[MUSHTRI_ID] [bigint] NOT NULL,
[MUSHTRI_PERSON_ID] [bigint] NOT NULL,
[MUSHTRI_SHARE] [nvarchar](50) NOT NULL,
[REVENUE] [nvarchar](255) NULL,
[MUSHTRI_TYPE_ID] [smallint] NOT NULL,
[ANNOTATION_ID] [bigint] NULL,
[LINK_ID] [bigint] NOT NULL,
[CREATED_BY] [nvarchar](255) NOT NULL CONSTRAINT [DF_TMUT_MUSHTRI_CREATED_BY] DEFAULT (N'SYSTEM'),
[MODIFIED_BY] [nvarchar](255) NOT NULL CONSTRAINT [DF_TMUT_MUSHTRI_MODIFIED_BY] DEFAULT (N'SYSTEM'),
[CREATED_DATE] [datetime] NOT NULL CONSTRAINT [DF_TMUT_MUSHTRI_CREATED_DATE] DEFAULT (getdate()),
[MODIFIED_DATE] [datetime] NOT NULL CONSTRAINT [DF_TMUT_MUSHTRI_MODIFIED_DATE] DEFAULT (getdate()),
[REMARKS] [nvarchar](max) NULL,
[ISMUTATION] [bit] NULL,
[given_share] [nvarchar](50) NULL,
[Taken_share] [nvarchar](50) NULL,
[ownertype_id] [bigint] NULL,
[Period_Id] [smallint] NOT NULL CONSTRAINT [DF_TMUT_MUSHTRI_Period_Id] DEFAULT ((1)),
[lockshare] [nvarchar](100) NOT NULL DEFAULT (N'0/1'),
CONSTRAINT [pk_tmut_mushtri] PRIMARY KEY CLUSTERED
(
[VILLAGE_ID] ASC,
[KHEWAT_NO] ASC,
[khatouni_no] ASC,
[MUTATION_NUMBER] ASC,
[MUSHTRI_ID] ASC,
[MUSHTRI_PERSON_ID] ASC,
[MUSHTRI_TYPE_ID] ASC,
[Period_Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
) ON [PRIMARY]

GO
ALTER TABLE [dbo].[TMUT_MUSHTRI] WITH CHECK ADD CONSTRAINT [FK_TMUT_MUSHTRI_TJAM_PERSON_DETAIL] FOREIGN KEY([MUSHTRI_PERSON_ID])
REFERENCES [dbo].[TJAM_PERSON_DETAIL] ([person_unique_id])
GO
ALTER TABLE [dbo].[TMUT_MUSHTRI] CHECK CONSTRAINT [FK_TMUT_MUSHTRI_TJAM_PERSON_DETAIL]

Thanks in advance for your help.

Ravish Kumar, Trident infotech Ltd. Team Lead.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-01-13 : 03:49:31
There is no solution to having a primary key that wide. You just can't do it as indexes are limited to 900 bytes. Instead you'll need to use a surrogate key, such as an identity column.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

ravish1179
Starting Member

3 Posts

Posted - 2011-01-13 : 04:00:11
quote:
Originally posted by tkizer

There is no solution to having a primary key that wide. You just can't do it as indexes are limited to 900 bytes. Instead you'll need to use a surrogate key, such as an identity column.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog



Thanks for your reply. I cannot change the structure of my table. However I can add additional column to it using the concept of included column but still i could not resolve this problem. Is there any solution using included column.

Ravish Kumar
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-01-13 : 04:19:11
Included column will not help here. If you can't change the structure, then you are stuck.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -