Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Delete rows in SQL

Author  Topic 

jazz1974
Starting Member

1 Post

Posted - 2013-04-23 : 04:25:14
I delete rows in Table on SQL . I use command "DELETE "name of table" ". after this command, SQl deleted these rows, but size of DB not changed in Hard Disk. I think programms selected these how deleted. How i can dlete phisical rows without command "DROP Table."
Thanks.

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-04-23 : 05:48:39
Use TRUNCATE statement if you want to delete all the rows... TRUNCATE will releases memory back

--
Chandu
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2013-04-23 : 07:06:30
quote:
Originally posted by bandi

Use TRUNCATE statement if you want to delete all the rows... TRUNCATE will releases memory back

--
Chandu


I believe that truncate table will release space INSIDE the mdf file(s) but will not release any space on hard disk.
What do think?


Too old to Rock'n'Roll too young to die.
Go to Top of Page

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-04-23 : 07:49:09
quote:
Originally posted by webfred
I believe that truncate table will release space INSIDE the mdf file(s) but will not release any space on hard disk.
What do think?

Yes webfred... TRUNCATE won't release memory immediately..
It depends on several scenarios...
http://blog.sqlauthority.com/2011/01/19/sql-server-shrinking-database-is-bad-increases-fragmentation-reduces-performance/

--
Chandu
Go to Top of Page

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-04-23 : 08:50:24
Not sure if OP is talking about memory, or disk usage. Seems like disk usage. In either case, deleting or truncating table will not release the resouce back to Windows OS. SQL OS will hold on to the freed up resource unless you make it release it back to Windows OS. To make it release the resource back to Windows OS, you will have to shrink the data file. But in most cases, shrinking the datafile is a bad idea. In addition to the link Chandu posted, take a look at this article to see why it is a bad idea: http://www.sqlskills.com/blogs/paul/why-you-should-not-shrink-your-data-files/

If you are short on disk space, examine what else is using up disk space. In particular, look at database log files. You can shrink them and keep their sizes small by frequent log backups (for full and bulk-logged recovery models) or using simple recovery model.
Go to Top of Page
   

- Advertisement -