Truncate table

  • Thread starter Thread starter Sala
  • Start date Start date
S

Sala

Hi
I want to truncate all data in database ... pls help me how i ll
truncate?
 
Sala said:
Hi
I want to truncate all data in database ... pls help me how i ll truncate?

Do you really mean "truncate"? Truncate typically means that you trim
extra blank space from the ends of character strings. It doesn't sound
like that is what you want to do.

Do you mean "delete"? If so, you have to tell us whether you want to
delete all rows in all tables (leaving the database table structure
intact, but with no data), or you want to drop all tables from the
database, leaving the database empty, without tables or data. The
correct term for the first is "delete" (rows of data), while the
correct term for the second is "drop" (tables).

So... what is it you want to do?
 
Hi
I want to truncate all data in database ... pls help me how i ll
truncate?

The truncate statement works as follows:

truncate table TableName

So all you need to do is run it for each of the tables in your database.
You'd probably put this in a stored procedure to make it easier to run
subsequently.

However there are caveats -- you can't use it to on tables that are
replicating, for instance
 
Bruce said:
Do you really mean "truncate"? Truncate typically means that you trim
extra blank space from the ends of character strings. It doesn't sound
like that is what you want to do.

Do you mean "delete"? If so, you have to tell us whether you want to
delete all rows in all tables (leaving the database table structure
intact, but with no data), or you want to drop all tables from the
database, leaving the database empty, without tables or data. The
correct term for the first is "delete" (rows of data), while the
correct term for the second is "drop" (tables).

So... what is it you want to do?

He probably want to do a TRUNCATE !

http://msdn2.microsoft.com/en-us/library/ms177570.aspx

Arne
 
Rad said:
The truncate statement works as follows:

truncate table TableName

So all you need to do is run it for each of the tables in your
database. You'd probably put this in a stored procedure to make it
easier to run subsequently.

However there are caveats -- you can't use it to on tables that are
replicating, for instance

Or on tables that are the target of foreign keys in other tables - even if
those other tables are empty!

-cd
 
Peter said:
And the winner is.. Otis! This question had absolutely nothing to do with C#
language issues.

Correct.

But it is only obvious if you know that it should be done
via a SQL command and not directly in C#.

If people asking questions knew everything, then they would
not need to ask questions.

Arne
 
Peter said:
Yes, and if everybody gave you exactly what you want 100% of the time, on a
silver platter, then you may never learn the protocol and netiquette, and
that would be too bad. Our job is not just to answer questions, but also to
help n00b posters become more professional so that they can better help
themselves.

And do you think the original poster learned anything from
your post ?

Not counting that he learned that some people in this group
are arrogant and rude !

Arne
 
And do you think the original poster learned anything from
your post ?

Not counting that he learned that some people in this group
are arrogant and rude !

Arne

Actually, when I posted the answer I made no arrogant remarks. I simply stated
that it was a question for the SQL Server group and gave the news group address.

Are you saying that the OP learned nothing from my answer?

I did not admonish the user, nor did I imply that I know more about civility or
SQL Server than the OP. Since I did give the OP the news group address I
suspect they learned that there was a group specifically for SQL Server
questions. Since there were no more questions posted by the OP I presume they
took the next logical step and consulted the SQL Server group I suggested.

On the other hand, your post does nothing to assist in the learning process. It
only admonishes Peter and I for what you perceived as bad behavior. I suggest
you take a look in the mirror and see who the arrogant party might be.

Good luck with your project,

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com
 
Actually, when I posted the answer I made no arrogant remarks. I simply stated
that it was a question for the SQL Server group and gave the news group address.

Are you saying that the OP learned nothing from my answer?

I did not say that.

Hint: when I quote someone and make a comment then my comment is
related to that and not to a previous non quoted post.

But regarding you post then:
- you did not explain why you think that the suggested newsgroup
was better
- it is a definite possibility that the suggestion was completely wrong
(TRUNCATE TABLE is a valid TSQL command - and if the poster knew that
then your suggestion is way off - but there are also the possibility
that the subject was chosen as plain english not TSQL in which case
your suggestion was a good one)

I did not find any reason to comment on that.
On the other hand, your post does nothing to assist in the learning process. It
only admonishes Peter and I for what you perceived as bad behavior. I suggest
you take a look in the mirror and see who the arrogant party might be.

My post did not have any benefit for the original poster.

But if it did make some of the more knowledgeable remember, that
once upon a time they where asking the wrong questions in the wrong
forums too, then it may help future posters.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top