Question:
How do I insert records into a sql database without constrains?I want to insert a record into the database and
- I want to set the primary key
- Want to disable any contraints
- I want no triggers to fire
Just just alter the table with NOCHECK CONSTRAINT.
ALTER TABLE [VokSample] NOCHECK CONSTRAINT ALL GO ALTER TABLE [VokSample] DISABLE TRIGGER ALL GO SET IDENTITY_INSERT [VokSample] ON INSERT INTO [VokSample] ([SmpId], [SmpOwnerName], [SmpExpression], [SmpLanguage], [SmpIsVerified], [CreatedOn], [CreatedBy], [ModifiedOn], [ModifiedBy], [IsDeleted]) VALUES(12000, N'admin', N'test sample.', N'en-GB', 0, '2009-03-10 17:55:08', N'admin', '2009-03-10 17:55:08', N'admin', 0) SET IDENTITY_INSERT [VokSample] OFF ALTER TABLE [VokSample] CHECK CONSTRAINT ALL GO ALTER TABLE [VokSample] ENABLE TRIGGER ALL GO
No comments:
Post a Comment