Sudharani G

Sudharani G

  • NA
  • 19
  • 713

While craeting 2nd table with foreign key getting an error?

Sep 1 2015 8:39 AM
CREATE TABLE [dbo].[tbl_AddItems](
[id] [int] IDENTITY(1,1) NOT NULL,
[ProductId] AS ('SHPLT'+right('0000'+CONVERT([varchar](10),[ID],(0)),(4)))PERSISTED NOT NULL,
CONSTRAINT PK_ProductId PRIMARY KEY CLUSTERED(ProductId),
[ProductCategory] [varchar](20) NULL,
[ProductName] [varchar](30) NULL,
[Price] [decimal](6, 2) NULL,
[ProductCode] [varchar](20) NULL,
[Descriptions] [varchar](max) NULL,
[Stock] [int] NULL,
[Discount] [int] NULL
)
CREATE TABLE [dbo].[tbl_AddImages]
(
[Id] INT IDENTITY(1,1) NOT NULL,
[ProductId] AS ('SHPLT'+right('0000'+CONVERT([varchar](10),[ID],(0)),(4)))PERSISTED NOT NULL,
CONSTRAINT [FK_ProductId] FOREIGN KEY([ProductId]) REFERENCES [tbl_AddItems] ([ProductId]),
[ImgId] [varchar](20) NULL,
[ImgPath] [varchar](100) NULL
)
 
here getting an error while creating tbl_AddItems
 "
CREATE TABLE failed because the following SET options have incorrect settings: 'ANSI_PADDING'. Verify that SET options are correct for use with indexed views and/or indexes on computed columns and/or filtered indexes and/or query notifications and/or XML data type methods and/or spatial index operations.
"
Can anyone help me? 

Answers (2)