December 22, 2008 at 7:56 am
hello,
what is trancate?
how should i do it?
thanks
December 22, 2008 at 8:07 am
Do you mean TRUNCATE?
December 22, 2008 at 8:08 am
Perhaps it would be better for you to describe what you are trying to do.
December 22, 2008 at 8:08 am
Yes,
Yes.
December 22, 2008 at 8:11 am
TRUNCATE is a way of removing all data from a table.
What are you trying to do?
December 22, 2008 at 8:12 am
Yes,
Yes.
December 22, 2008 at 8:16 am
i want to remove all rows , then modify my table deign, how can i use Truncate?
December 22, 2008 at 8:29 am
TRUNCATE TABLE [TableName]
This will remove all rows from the table. TRUNCATE is a non-logged operation, so if you are using log shipping or have regular log backups running, it can cause you some issues. It is also pretty much instant.
There is also no un-do on this, these records will be gone forever.
December 22, 2008 at 8:31 am
If you are interested in the internals of what is happening that is different than:
DELETE [TableName]
I recommend you read the TRUNCATE and DELETE topics in books online.
December 22, 2008 at 8:37 am
Michael Earl (12/22/2008)
TRUNCATE is a non-logged operation, so if you are using log shipping or have regular log backups running, it can cause you some issues.
Not at all.
Truncate table is minimally logged. The page deallocations are logged, the rows are not. Hence log shipping and log backups aren't affected, it can also be rolled back if run within an explicit transaction.
Transactional replication won't allow a truncate, because of the way it moves transactions around.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
December 22, 2008 at 8:55 am
Don't bite my head off Gail, just wanted to make the point that it is logged "differently" without typing out a lot of detail.
It's a holiday week - need to save my energy.
December 22, 2008 at 9:09 am
Michael Earl (12/22/2008)
Don't bite my head off Gail,
Not biting anything
just wanted to make the point that it is logged "differently" without typing out a lot of detail.
Sorry, it's just a common myth that Truncate is not logged and breaks log chains, log shipping, etc, etc
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
December 23, 2008 at 12:07 am
TRUNCATE is a non-logged operation, so if you are using log shipping or have regular log backups running, it can cause you some issues.
sorry what do you mean by non-logged operation?
December 23, 2008 at 1:10 am
about Writing Truncate only i should open a new quer and write
Truncate Servername.Databasename.dbo.Tablename
in it ?
December 30, 2008 at 9:34 am
nazaninahmady_sh (12/22/2008)
i want to remove all rows , then modify my table deign, how can i use Truncate?
If all you are trying to do is change the structure of the table, you do not have to get rid of the data to do this.
Is this a table you created and are trying to change? Is the existing data of no use?
Steve
Viewing 15 posts - 1 through 15 (of 16 total)
You must be logged in to reply to this topic. Login to reply