473,320 Members | 1,854 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Truncate table

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

Dec 16 '06 #1
14 12227

Sala wrote:
Hi
I want to truncate all data in database ... pls help me how i ll
truncate?
Sala wrote:
I am using sql server 2000..
Dec 16 '06 #2

Sala wrote:
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?

Dec 16 '06 #3
On 15 Dec 2006 23:58:45 -0800, Sala wrote:
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

--
Bits.Bytes
http://bytes.thinkersroom.com
Dec 16 '06 #4
Bruce Wood wrote:
Sala wrote:
> 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?
He probably want to do a TRUNCATE !

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

Arne
Dec 16 '06 #5
Rad [Visual C# MVP] wrote:
On 15 Dec 2006 23:58:45 -0800, Sala wrote:
>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
Or on tables that are the target of foreign keys in other tables - even if
those other tables are empty!

-cd
Dec 16 '06 #6

Arne Vajhøj wrote:
Bruce Wood wrote:
Sala wrote:
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?

He probably want to do a TRUNCATE !

http://msdn2.microsoft.com/en-us/library/ms177570.aspx
Ahhh! Shows how much I know, doesn't it? :-)

Dec 16 '06 #7
On 15 Dec 2006 23:58:45 -0800, "Sala" <sa**********@gmail.comwrote:
>Hi
I want to truncate all data in database ... pls help me how i ll
truncate?
Actually that is not a C# question.

Why not try: microsoft.public.sqlserver.newusers?

Good luck with your project,

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com
Dec 17 '06 #8
And the winner is.. Otis! This question had absolutely nothing to do with C#
language issues.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Otis Mukinfus" wrote:
On 15 Dec 2006 23:58:45 -0800, "Sala" <sa**********@gmail.comwrote:
Hi
I want to truncate all data in database ... pls help me how i ll
truncate?

Actually that is not a C# question.

Why not try: microsoft.public.sqlserver.newusers?

Good luck with your project,

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com
Dec 17 '06 #9
On Sat, 16 Dec 2006 17:22:00 -0800, Peter Bromberg [C# MVP]
<pb*******@yahoo.nospammin.comwrote:
>And the winner is.. Otis! This question had absolutely nothing to do with C#
language issues.
Peter
Thanks, Peter!

Where do I go to collect the prize? ;o)

Good luck with your project,

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com
Dec 20 '06 #10
Peter Bromberg [C# MVP] wrote:
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
Dec 24 '06 #11
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.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Arne Vajhøj" wrote:
Peter Bromberg [C# MVP] wrote:
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
Dec 24 '06 #12
Peter Bromberg [C# MVP] wrote:
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
Dec 25 '06 #13
On Sun, 24 Dec 2006 23:20:30 -0500, Arne Vajhøj <ar**@vajhoej.dkwrote:
>Peter Bromberg [C# MVP] wrote:
>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
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
Dec 25 '06 #14
Otis Mukinfus wrote:
On Sun, 24 Dec 2006 23:20:30 -0500, Arne Vajhøj <ar**@vajhoej.dkwrote:
>Peter Bromberg [C# MVP] wrote:
>>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 !
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

Dec 25 '06 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Ed | last post by:
I am trying to get some information to compare and contrast the Truncate Table function and the Drop Table function. I know that using Truncate Table is faster and saves the structure of the table...
3
by: martin | last post by:
Hi, We have a heavily used production server and a table which logs every hit on a web site. This table has grown large over time and we want to clear it down as efficiently as possible. We would...
3
by: LineVoltageHalogen | last post by:
Greeting All, I have a stored proc that dynamically truncates all the tables in my databases. I use a cursor and some dynamic sql for this: ...... create cursor Loop through sysobjects and...
5
by: ronin 47th | last post by:
Hi group, In one of the books 'Gurus Guide to Transact SQL' i found this info: ------------------------------------------------------------ TRUNCATE TABLE empties a table without logging row...
2
by: rdraider | last post by:
Hi, I am trying to create a script that deletes transaction tables and leaves master data like customer, vendors, inventory items, etc. How can I use TRUNCATE TABLE with an Exists? My problem is...
9
by: Sumanth | last post by:
Are there any implementations of truncate in db2. Is it going to be implemented in the future? Is there an alternate way of doing a truncate of a table that has a high record count without using...
6
by: pramod | last post by:
Hi I know we can truncate a table in DB2 by first creating it with NOT LOGGED INITIALLY option. and when we need to truncate it, run the following command alter table <table name> activate...
2
by: Neil | last post by:
Can one use Truncate Table on a linked server table? When I try it, I get a message that only two prefixes are allowed. Here's what I'm using: Truncate Table svrname.dbname.dbo.tablename
10
by: Troels Arvin | last post by:
Hello, Until this date, I believed that DB2 has no TRUNCATE TABLE command. But then I came across...
8
by: ananthaisin | last post by:
How to reduce the table size for any table while using truncate or delete statements. In oracle 8i it was truncating the storage space but in 10g it is not .... I have given truncate statement in...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.