Re: DTS in SQL 2005 on tables with constraints



Hello Larry,

Why do you need to do a TRUNCATE? Can you not do incremental loads as truncating the table would suggest that you are completely reloading the tables.

--

Allan Mitchell
http://wiki.sqlis.com | http://www.sqlis.com | http://www.sqldts.com |
http://www.konesans.com

Thanks for that Allan,

The problem is that the developers could have added / removed
constraints in between running the scripts and actually generating the
script to have the ALTER TABLEs to reinstate the constraints is a pain
on this many tables.

I was hoping there was a more intelligent dynamic way of temporarily
getting rid of the constraints while I run the import and then
reinstating them. I thought that EXEC sp_msforeachtable "ALTER TABLE
? NOCHECK CONSTRAINT all" might do the trick, but you can't TRUNCATE
the table unless you actually remove the constraints.

Any suggestions?

Larry.



.



Relevant Pages

  • Re: truncate table - with foreign key constraints
    ... TRUNCATE is simply not allowed with foreign key constraints in place. ... You'll need to go through the trouble for dropping and recreating the ...
    (microsoft.public.sqlserver.server)
  • Re: how to boost drop table statement
    ... >>>You could try to TRUNCATE the tables first, but then they must not have ... >>>foreign key constraints. ... Assuming no cross-referencing referential integrity, ... * FirstSQL/J Object/Relational DBMS ...
    (comp.lang.java.databases)
  • Re: resetting seed
    ... Read about constraints in the BOL. ... CREATE TABLE MyCustomers PRIMARY KEY, ... I have to reset the identity seed on one of my SQL Server CE tables. ... only TRUNCATE TABLE is my option. ...
    (microsoft.public.sqlserver.ce)
  • Disabling Constraint for Bulk Loading
    ... For this i want to disable all the constraints on all the user ... fetch next from c1 into @tablename ... Now when i try to truncate one of the tables (say titles) it gives me ...
    (comp.databases.ms-sqlserver)
  • truncate table - with foreign key constraints
    ... I have a database with foreign key constraints. ... truncate tables to perform data loads. ...
    (microsoft.public.sqlserver.server)

Loading