Click here to Skip to main content
15,894,740 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
CREATE TABLE [dbo].[tblVehicleCategory](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [CategoryName] [nvarchar](50) NULL,
    [NumberOfSeats] [int] NOT NULL,
    [Description] [nvarchar](max) NULL,
    [CorporateID] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_tblVehicleCategory] PRIMARY KEY CLUSTERED
(
    [ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[tblVehicleCategory]  WITH CHECK ADD FOREIGN KEY([CorporateID])
REFERENCES [dbo].[tblCorporateProfile] ([CorporateID])
GO
Posted

1 solution

Hi ,

First drop the constraint FK, then change data type and create FK again using appropriate syntax.


Regards,
Mubin
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900