Quantcast
Channel: SQL Server Database Engine forum
Viewing all articles
Browse latest Browse all 12963

ALTER TABLE [dbo].[TestTable] WITH NOCHECK ADD CONSTRAINT [CK_CusRptC_TestColID] CHECK NOT FOR REPLICATION (([TestColID]=(3681)))

$
0
0

 
/****** Object:  Table [dbo].[TestTable]    Script Date: 06/18/2014 15:57:51 ******/

I have a table script same as below.


SET ANSI_NULLS ON
GO
 
SET QUOTED_IDENTIFIER ON
GO
 
SET ANSI_PADDING ON
GO
 
CREATE TABLE [dbo].[TestTable](
      [TestIdenID] [int] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,
      [TestColID] [smallint] NOT NULL,
CONSTRAINT [PK_TestTable] PRIMARY KEY CLUSTERED
(
      [TestIdenID] ASC,
      [TestColID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON, FILLFACTOR = 70) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
 
GO
 
SET ANSI_PADDING OFF
GO

 
ALTER TABLE [dbo].[TestTable]  WITH NOCHECK ADD  CONSTRAINT [CK_CusRptC_TestColID] CHECK NOT FOR REPLICATION (([TestColID]=(3681)))
GO
 
ALTER TABLE [dbo].[TestTable] CHECK CONSTRAINT [CK_CusRptC_TestColID]
GO
 
ALTER TABLE [dbo].[TestTable] ADD  CONSTRAINT [DF_CusRptCTestColID]  DEFAULT ((3681)) FOR [TestColID]
GO
 
 

I am trying to insert the value using insert query same as below

 
INSERT INTO TestTable(TestColID)
VALUES (1224)


But while trying to execute the query I am getting the Check constraint error. Could some one please explain the reason why I am getting that error.


I have gone throught couple of blogs but I didn't get the solution.

Please help me to understand the problem

Thank you
Srikanth  




 
 
 
 
 

Viewing all articles
Browse latest Browse all 12963

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>