Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2003
    Posts
    19

    Unanswered: temporarily set constraints off

    is there any way to temporarily set constraints off just for administrative tasks?

    what i want is something like this:

    sp_constraints off

    ..some administrative stuff..

    sp_constraints on

    and at this point continue working with db in a standard constrained way. it doesn't matter if it's needed to put the database offline

  2. #2
    Join Date
    Jul 2003
    Location
    The Dark Planet
    Posts
    1,401
    What is the kind of administrative stuff you want to do ....
    Get yourself a copy of the The Holy Book

    order has no physical Brett in The meaning of a Kaiser . -database data

  3. #3
    Join Date
    Dec 2003
    Posts
    19
    Originally posted by Enigma
    What is the kind of administrative stuff you want to do ....
    insert data without mattering fulfilling constraints, alter tables...

    such kind of administrative stuff

  4. #4
    Join Date
    Jul 2003
    Location
    The Dark Planet
    Posts
    1,401
    read up the following topic in SQL Books online

    constraints, CHECK
    Get yourself a copy of the The Holy Book

    order has no physical Brett in The meaning of a Kaiser . -database data

  5. #5
    Join Date
    Dec 2003
    Posts
    19

    constraints

    Originally posted by Enigma
    read up the following topic in SQL Books online
    thanks but what I want to avoid (thus temporarily set off) is referencial integrity constraints not check constraints

  6. #6
    Join Date
    Sep 2003
    Location
    Dallas, Texas
    Posts
    311

    Re: constraints

    Not a really good idea to avoid RI when you inserting rows. Problems needs to be resolved before it hits database.

    Just talking like a true DBA.

  7. #7
    Join Date
    Dec 2003
    Posts
    19

    Re: constraints

    I know but it just for testing purposes. Anyway I've found the way to do that, simply:

    sp_msforeachtable "alter table ? nocheck constraint all"

    .. do the dirty stuff here ...

    sp_msforeachtable "alter table ? check constraint all"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •