Home > Archive > MS SQL Server > March 2006 > How to disable foreign key constrain when insert









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to disable foreign key constrain when insert
ad

2006-03-05, 8:24 pm

I want to insert a lot of data into two tables.
There is a foreign key constrain between.
How can I disable this foreign key constrain when inserting?


Tibor Karaszi

2006-03-05, 8:24 pm

ALTER TABLE tblname NOCHECK...contraintname.

But that goes not only for your connection, so be careful.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www. solidqualitylearning
.com/

Blog: http:// solidqualitylearning
.com/blogs/tibor/



"ad" <flying@wfes.tcc.edu.tw> wrote in message news:OdHV8E1PGHA.720@TK2MSFTNGP14.phx.gbl...
>I want to insert a lot of data into two tables.
> There is a foreign key constrain between.
> How can I disable this foreign key constrain when inserting?
>
>

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com