Truncate all tables in SQL Server db
From: Partha (mcp111_at_hotmail.com)
Date: 03/18/04
- Next message: Delbert Glass: "Re: Combing two case statements into one"
- Previous message: DPM: "Re: SQL Server 2000 speed problems"
- In reply to: Vlad: "Truncate all tables in SQL Server db"
- Next in thread: Vlad: "Re: Truncate all tables in SQL Server db"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 18 Mar 2004 07:43:27 -0800
Microsoft provides a built-in stored procedure for such
tasks
use the following command
sp_msforeachtable 'truncate table ?'
this will truncate all the tables in your database.
>-----Original Message-----
>I'm moving VB 6 project from Access to SQL Server. First
step is to continue
>to use Access with linked to SQL Server tables. A made
already all required
>changes in code.
>I have prepared a copy of Access database with data in
SQL Server by running
>DTS. Then I restored lost primary keys and made some
other changes.
>A also prepared a copy of Access database without data
(just linked tables).
>Then because the current Access db is in use all the time
I will need to
>stop its use for as short as possible time to transfer
data to SQL Server
>and start to use a database with linked tables.
>I need to truncate all tables in SQL Server first and
then to run DTS to
>transfer the most current data from Access.
>Is there any way to truncate all tables in SQL Server in
one step? Or I need
>to run "truncate table table1" then "truncate table
table2" and so on? Due
>to number of tables it's going to take a lot of time
which is not desirable.
>
>Thank you
>Vlad
>
>
>.
>
- Next message: Delbert Glass: "Re: Combing two case statements into one"
- Previous message: DPM: "Re: SQL Server 2000 speed problems"
- In reply to: Vlad: "Truncate all tables in SQL Server db"
- Next in thread: Vlad: "Re: Truncate all tables in SQL Server db"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|