Showing posts with label tablename. Show all posts
Showing posts with label tablename. Show all posts

Wednesday, March 7, 2012

Deleted 99 of 154 columns, yet size of table is still the same?

I had a table with 154 columns. I dropped 99 of them. Each had a lot of
data in them.
But afterwards, when I sp_spaceused TABLENAME, the results in terms of
size were still the same.
Is there something I'm missing?
[ Sugapablo ]
[ http://www.sugapablo.net <--personal | http://www.sugapablo.com <--music ]
[ http://www.2ra.org <--political | http://www.subuse.net <--discuss ]
See DBCC CLEANTABLE in the BOL
"Sugapablo" <russ@.REMOVEsugapablo.com> wrote in message
news:pan.2005.05.24.10.51.15.294163@.REMOVEsugapabl o.com...
> I had a table with 154 columns. I dropped 99 of them. Each had a lot of
> data in them.
> But afterwards, when I sp_spaceused TABLENAME, the results in terms of
> size were still the same.
> Is there something I'm missing?
> --
> [
]
> [ http://www.sugapablo.net <--personal | http://www.sugapablo.com
<--music ]
> [ http://www.2ra.org <--political | http://www.subuse.net
<--discuss ]
>
|||Try running DBCC UPDATEUSAGE and see if that changes anything.
Andrew J. Kelly SQL MVP
"Sugapablo" <russ@.REMOVEsugapablo.com> wrote in message
news:pan.2005.05.24.10.51.15.294163@.REMOVEsugapabl o.com...
>I had a table with 154 columns. I dropped 99 of them. Each had a lot of
> data in them.
> But afterwards, when I sp_spaceused TABLENAME, the results in terms of
> size were still the same.
> Is there something I'm missing?
> --
> [
> ]
> [ http://www.sugapablo.net <--personal | http://www.sugapablo.com
> <--music ]
> [ http://www.2ra.org <--political | http://www.subuse.net
> <--discuss ]
>
|||Hi
Just check for DBCC CLEANTABLE in BOL
http://msdn.microsoft.com/library/en...asp?frame=true
this might help you
best Regards,
Chandra
http://chanduas.blogspot.com/
http://groups.msn.com/SQLResource/
"Sugapablo" wrote:

> I had a table with 154 columns. I dropped 99 of them. Each had a lot of
> data in them.
> But afterwards, when I sp_spaceused TABLENAME, the results in terms of
> size were still the same.
> Is there something I'm missing?
> --
> [ Sugapablo ]
> [ http://www.sugapablo.net <--personal | http://www.sugapablo.com <--music ]
> [ http://www.2ra.org <--political | http://www.subuse.net <--discuss ]
>

Deleted 99 of 154 columns, yet size of table is still the same?

I had a table with 154 columns. I dropped 99 of them. Each had a lot of
data in them.
But afterwards, when I sp_spaceused TABLENAME, the results in terms of
size were still the same.
Is there something I'm missing?
[ Sugapablo
]
[ http://www.sugapablo.net <--personal | http://www.sugapablo.com <--mu
sic ]
[ http://www.2ra.org <--political | http://www.subuse.net <--di
scuss ]See DBCC CLEANTABLE in the BOL
"Sugapablo" <russ@.REMOVEsugapablo.com> wrote in message
news:pan.2005.05.24.10.51.15.294163@.REMOVEsugapablo.com...
> I had a table with 154 columns. I dropped 99 of them. Each had a lot of
> data in them.
> But afterwards, when I sp_spaceused TABLENAME, the results in terms of
> size were still the same.
> Is there something I'm missing?
> --
> [
]
> [ http://www.sugapablo.net <--personal | http://www.sugapablo.com
<--music ]
> [ http://www.2ra.org <--political | http://www.subuse.net
<--discuss ]
>|||Try running DBCC UPDATEUSAGE and see if that changes anything.
Andrew J. Kelly SQL MVP
"Sugapablo" <russ@.REMOVEsugapablo.com> wrote in message
news:pan.2005.05.24.10.51.15.294163@.REMOVEsugapablo.com...
>I had a table with 154 columns. I dropped 99 of them. Each had a lot of
> data in them.
> But afterwards, when I sp_spaceused TABLENAME, the results in terms of
> size were still the same.
> Is there something I'm missing?
> --
> [
> ]
> [ http://www.sugapablo.net <--personal | http://www.sugapablo.com
> <--music ]
> [ http://www.2ra.org <--political | http://www.subuse.net
> <--discuss ]
>|||Hi
Just check for DBCC CLEANTABLE in BOL
http://msdn.microsoft.com/library/e...asp?frame=true
this might help you
best Regards,
Chandra
http://chanduas.blogspot.com/
http://groups.msn.com/SQLResource/
---
"Sugapablo" wrote:

> I had a table with 154 columns. I dropped 99 of them. Each had a lot of
> data in them.
> But afterwards, when I sp_spaceused TABLENAME, the results in terms of
> size were still the same.
> Is there something I'm missing?
> --
> [ Sugapablo
]
> [ http://www.sugapablo.net <--personal | http://www.sugapablo.com <--
music ]
> [ http://www.2ra.org <--political | http://www.subuse.net <--
discuss ]
>

Sunday, February 19, 2012

delete records in tables

Is there any built-in tool that can delete tabel
records/contents in sql server? I can run delete from
tablename script, but there are two many tables. is there
an easy way?Look at this...
Declare @.sql varchar(8000)
set @.sql=''
select @.sql=@.sql + ' Truncate Table ' + name from sysobjects where
xtype='U'
EXEC(@.SQL) -- Truncates all tables
set @.sql=''
Select @.sql=@.sql + ' DROP TABLE ' + name from sysobjects where xtype='U'
EXEC(@.SQL) -- Drops all tables
HTH
"Matt" <spam@.spam.com> escreveu na mensagem
news:108001c3a920$524706e0$a101280a@.phx.gbl...
> Is there any built-in tool that can delete tabel
> records/contents in sql server? I can run delete from
> tablename script, but there are two many tables. is there
> an easy way?
>|||If you run the following SQL it will create a DELETE script for every table
that can then be ran.
SELECT 'DELETE FROM ' + TABLE_SCHEMA+'.'+TABLE_NAME + char(10) + 'GO'
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE='BASE TABLE'
--
HTH
Ryan Waight, MCDBA, MCSE
"Matt" <spam@.spam.com> wrote in message
news:108001c3a920$524706e0$a101280a@.phx.gbl...
> Is there any built-in tool that can delete tabel
> records/contents in sql server? I can run delete from
> tablename script, but there are two many tables. is there
> an easy way?
>|||Hi,
Truncate table command will not succeed if there is FK relation ship. The
parent table will fail with below error,
Server: Msg 4712, Level 16, State 1, Line 1
Cannot truncate table 'table name' because it is being referenced by a
FOREIGN KEY constraint.
In this case you have to use delete command. (delete the child table using
Truncate command and use delete command for Parent table)
Thanks
Hari
MCDBA
"Wandenkolk T. Neto" <wandenkolkneto@.hotmail.com> wrote in message
news:#u4uRLSqDHA.688@.TK2MSFTNGP10.phx.gbl...
> Look at this...
> Declare @.sql varchar(8000)
> set @.sql=''
> select @.sql=@.sql + ' Truncate Table ' + name from sysobjects where
> xtype='U'
> EXEC(@.SQL) -- Truncates all tables
> set @.sql=''
> Select @.sql=@.sql + ' DROP TABLE ' + name from sysobjects where
xtype='U'
> EXEC(@.SQL) -- Drops all tables
>
> HTH
> "Matt" <spam@.spam.com> escreveu na mensagem
> news:108001c3a920$524706e0$a101280a@.phx.gbl...
> > Is there any built-in tool that can delete tabel
> > records/contents in sql server? I can run delete from
> > tablename script, but there are two many tables. is there
> > an easy way?
> >
>