Reclain Space After DROP COLUMN

Jul 23, 2005

I have a huge table in it own tablespace (250 GB). I just deleted more than
half of the columns in that table, but I didn't see any change in allocated
space. I did DBCC CLEANTABLE and DBCC SHRINKFILE, but nothing. MS also says
that CLEANTABLE only reclaims space for columns with text, char datatypes.
How can I get space back for integer, decimal, number datatypes? I'm just
all out of ideas.

View 7 Replies


ADVERTISEMENT

Reclaim Disk Space After DROP Columns

Aug 2, 2006

Hello,I tried to make what one reply advice to recover the disk space afterDROPed columns but it doesn't work. I did DBCC DBREINDEX to the tablebut nothing changes.Any other solution?Ignacio

View 5 Replies View Related

SQL Server 2008 :: How To Delete Or Drop Index To Free Up Space

May 31, 2015

I am new to mssql server. There is a table on one of my databases that occupies a lot of space. And the space usage is as follows: (all values in KB)

reserved: 42329064
data: 16272288
index: 26050032
unused: 6744

This table takes up almost 80% of my database size, and the information is this table just captures the time spent by a user on the website(not very critical data)

I would like to know how to delete the entire index (which is what is occupying most space) to free up disk space. the index is a clustered index.

View 3 Replies View Related

ALTER TABLE DROP COLUMN LastUpdated Failed Because One Or More Objects Access This Column.

Mar 7, 2008

Hi I’m trying to alter a table and delete a column I get the following error. The object 'DF__Morningst__LastU__19EB91BA' is dependent on column 'LastUpdated'.
ALTER TABLE DROP COLUMN LastUpdated failed because one or more objects access this column. I tried deleting the concerned constraint. But the next time I get the same error with a different constraint name. I want to find out if I can dynamically check the constraint name and delete it and then drop the column. Can anyone help.IF EXISTS(SELECT 1FROM sysobjects,syscolumnsWHERE sysobjects.id = syscolumns.idAND sysobjects.name = TablenameAND syscolumns.name = column name)BEGIN EXECUTE ('ALTER TABLE tablename DROP CONSTRAINT DF__SecurityM__DsegL__08C105B8')EXECUTE ('ALTER TABLE tablenameDrop column columnname)ENDGO
 

View 1 Replies View Related

DROP COLUMN

Feb 14, 2000

Does anyone know why this does not work?

ALTER TABLE deal DROP COLUMN TestField

Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near 'TestField'.

Thanks,
Paul

View 4 Replies View Related

How To Drop A Column?

Aug 30, 2006

Hi:

'Unfortunately', there is still a SQL6.5 sp4 server that I need to handle.
I need to drop a coulmn xyz from an important table tblABC.
But neither Enterprise manager could do it nor
'alter table tblABC drop column xyz' could run.

Without the hastle of makin a tblABCcopy and copy all data from tblABC except column xyz and re-do all fks; is there another way to drop the column?

thanks
-D

View 1 Replies View Related

Drop A Column

Apr 6, 2015

I have a question, Every month I get a request from cutomer service to go into a SQL VIEW and DELETE a column to reflect the past Month. How to write a query to create a SQL job to performed this task automatically. For example today I deleted the column [2015/03] which represents the month of March. The columns left are [2015/04] representing the current month, [2015/05], [2015/06],[2015/07]....[2016/08].Next month I will have to delete column [2015/04]and the current month will be [2015/05]....etc.

So I'm thinking I will have to Drop the column and also Maybe using a date funtion to look at the current date and format it to reflect [YYYY/MM] and IF the Column Month is less than current date month then drop the column.

View 3 Replies View Related

Drop Column

Mar 15, 2007

How to drop single column in a table.........

View 3 Replies View Related

How To Drop Primary Key By Specifying Column Only?

Apr 24, 2007

I checked column from xsd file which created from DataBase.
And before installing my application I will check any column in destination base whether have complete column or not.
 
And if there is any column which is not wanted column(not same as xsd structure)
I will delete it by creating sql command as follow "ALTER TABLE tableName DROP COLUMN column1, column2, ......"
and Execute it by program initialization.
 
So
I need delete it by run-time
 
 
However some column may be Primary Key with any reason
 
That's why I can't delete them by simple command
 
I expect to delete them by specific column instead of specific constraint name which is not sure name.
 
 
Please advise me....

View 2 Replies View Related

Drop A Column In A Table!!

Aug 2, 2001

Hi all,
how can I drop a column in a table.

View 1 Replies View Related

Can't Drop Column That Has A Default

Jun 13, 2008

I did this...

ALTER TABLE tm_spn_equip_def ADD Customer_No int NOT NULL DEFAULT dbo.f_spn_GetCustomerNo() WITH VALUES

Now when I attempt to do this...

ALTER TABLE tm_spn_equip_def DROP COLUMN Customer_No

I get an error:

Msg 5074, Level 16, State 1, Line 1
The object 'DF__tm_spn_eq__Custo__019E3B86' is dependent on column 'Customer_No'.
Msg 4922, Level 16, State 9, Line 1
ALTER TABLE DROP COLUMN Customer_No failed because one or more objects access this column.


How can I get around this?

TIA!

View 4 Replies View Related

How Can I Drop A Column From A Table?

Dec 13, 2007

Hi all!

One more question: how can i drop a column from a table?

Greetings

landau

View 2 Replies View Related

Drop Column Problem

Jul 20, 2005

Hello,I'm just returning to MS SQL Server after two years of dealing withSybase ASE. I need to drop a column, using the alter table command.I keep getting an error indicating that a constraint is using thecolumn. Here is the create script for the tablecreate table mytable(col1 char(1) not null,col2 char(1) default 'A' not null)Here is the alter table command:alter table mytable drop column col2When I run it I get the following error:Server: Msg 5074, Level 16, State 1, Line 1The object 'DF__mytable__col2__114A936A' is dependent on column'col2'.Server: Msg 4922, Level 16, State 1, Line 1ALTER TABLE DROP COLUMN col2 failed because one or more objects accessthis column.Is there anyway to tell the database to drop all column constraintswhen the column is deleted?Thanks,James K.

View 2 Replies View Related

How Do I Drop A Column From A Table

Oct 6, 2007



I have a database that I have made using sql server 2005 express edition. I want to run a query to drop one of the columns from one of the tables. I have tried the following but had no luck.

USE database


DROP column FROM table



This is the error that I got when I tried this.


Msg 156, Level 15, State 1, Line 3

Incorrect syntax near the keyword 'FROM'.

Of course, my query had the real database, table and column names. I have generic ones that I have provided here.

Do I have to alter the table instead of dropping the column that I don't want?
Do I have to remake the table without the column that I don't want?

View 1 Replies View Related

Drop Column With Constraint

Sep 25, 2007



Hello !

I am using Microsoft SQL Server 2000

I am trying to drop a column that has a constraint, executing the script inside a transaction:

BEGIN TRANSACTION

ALTER TABLE MOPTeste DROP CONSTRAINT FK_IDMOPPais


ALTER TABLE MOPTeste DROP COLUMN IDMOPPais

COMMIT

If i dont commit the drop constraint, it wont let me drop the column

Solutions?



View 3 Replies View Related

Drop Indentity From Column

Dec 6, 2007

I am trying to remove the Indentity property from a column so I can do some clean up. Then will need to add it back. Adding Indentity property back is not a problem, but cant figure out how to remove it in the first place.

Any help would be greatly apprecaited.

Thanks
Dave

View 4 Replies View Related

Drop Identity Property Of A Column

May 24, 2005

Is there a way to remove the Identity property of a column in SQL Server 2000? 
The statement:
<code>
ALTER TABLE <table name> ALTER COLUMN <column name> DROP IDENTITY
</code>
returns a syntax error.
Thank you,
Jeff

View 11 Replies View Related

How To Drop UNIQUE CONSTRAINT On Only One Column

May 5, 2014

I am very new to sql and I have got this doubt.

CREATE TABLE employee
{ EMP-ID VARCHAR UNIQUE,
DESIG VARCHAR UNIQUE,
SALARY INT };

Probably this is worst table ever created :).Now How to drop UNIQUE constraint on only column lets DESIG.

if i write

ALTER TABLE employee
DROP CONSTRAINT myuniqueconstraint;

will drop constraints on both columns which I dont want.

Any query that remove UNIQUE CONSTRAINT only on DESIGN column.

and one more clarification,

ALTER TABLE employee
MODIFY SALARY INT NOT NULL;

ALTER TABLE employee
ALTER COLUMN SALARY INT NOT NULL;

which of the above two is right query to add NOT NULL constraint to the above employee TABLE?

View 1 Replies View Related

When Do I Need To Drop Column Statistics When Doing An Alter?

Aug 30, 2007



I need to know definitively when I need to drop and recreate column statistics (histogram) when altering a column. Empirically, it seems I can lengthen a varchar or change a not null column to a nullable one, and then existing statistics dont' cause


Msg 5074, Level 16, State 1, Line 1

The statistics 'c1' is dependent on column 'c1'.

Msg 4922, Level 16, State 9, Line 1

ALTER TABLE ALTER COLUMN c1 failed because one or more objects access this column.


But, if I change a column to not nullable or shorten a column, I get the error.

Is this the complete description of when I need to drop and recreate column statistics and when I don't?

View 3 Replies View Related

Drop All Column Extended Propterties

Mar 25, 2006

Need help with admin scripts.

Have written stored procs to insert/update/drop column extended props but can't quite figure out how to drop all extended props for a particular table::column.

Tried stored proc to cursor on result

fn_listextendedproperty

but couldn't get that to work.

Where are xtended props stored in db?



View 1 Replies View Related

Alter Column Drop Identity

Apr 18, 2008

Is there any way to remove the IDENTITY property of a column? I originally used it, but it caused so many headaches with ADO.NET that I've decided to just increment the darn things manually. So I want to turn it into just a normal integer column.

If there's no direct way, can someone suggest a quick way to create a new column, copy all the old values into the new column, change the primary key to the new column, and drop the old column?

Thanks.

View 3 Replies View Related

Alter Table Drop Column Error

Apr 11, 2001

1. We have user defined type (Sql type = bit ) with rule setting it to 0
2. New column(isVIP) was created using this user defined type
3. sp_unbindrule was used to unbind rule from new column (isVIP)
4. Alter table Client drop Column isVIP !!!! (invalid syntax )

Any ideas ?
Thanks

View 4 Replies View Related

SQL Server 2012 :: Drop And Update Column?

Feb 16, 2015

I am looking for standard sql code for below 2 concern.

1- I want to drop the column Rowchecksum to all the table where table name start with ArchiveBbx

2-I want to update all the table where table name start with ArchiveBbx

example:-

Update table Archivebbxfbcc
set Rowchecksum=HASHBYTES('MD5', CAST(CHECKSUM(Col001, Col002, Col003, Col004) AS varchar(max)))

View 3 Replies View Related

Reporting Services :: How To Drop Unique Key Column

Jun 9, 2015

How to drop the unique key column in sql.

View 2 Replies View Related

Reporting Services :: How To Drop Primary Key Column

Jun 9, 2015

How to drop the primary key Column in Sql and How to drop Primary key Constraint From Column at  Table  in Sql.

View 6 Replies View Related

Transact SQL :: Check DB Consistency After DROP COLUMN

Apr 25, 2015

I have a SQL Server 2005 DB in which a design change requires me to drop a column.Is there a way of identifying all references in the DB including functions & stored procs's that reference this column? I understand there are 3rd party products that can do this but was wondering if there was something baked into SQL Server itself.

View 8 Replies View Related

Locking Column (cannot Drop Columns In The Table)

May 27, 2015

How can I pervert dropping the column in the table (probably some process doing that and I want to find it) ? I need to be able to modify but not alter / drop column .

View 4 Replies View Related

Column Space Utilization

Aug 3, 2007

Hello

I created a table with column name "description" as varchar(8000). My doubt is if I am not storing 8000 characters in this column, will SQL Server use memory space needed for 8000 characters ? or will it use only the space that needs for my text. ?

Thanking You
Navaneeth

View 8 Replies View Related

Column Delimiter As A SPACE?

Jul 25, 2007

I'm in a flat file connection manager editor and I have a flat file where the columns are separated by a space. Does anyone know how to specify a space in the column delimiter option? I've tried {' '} and {s} but these don't work. Not sure what the syntax is for indicating a space. Thanks in advance

View 1 Replies View Related

Extra Space For Column???

Dec 27, 2007

Hi,
I am declaring a table with 2 column Id, and Name.
Id is a integer column but Name is a Varchar.
I am declaring Name as VARCHAR(100) you can say that varchar(100) is more than enougf for a name column. But lets suppose ifn futuer user will enter data only till 100 characters but lets suppose i put or declare it as NAME VARCHAR(4000), That means a column requires only 100 memory space but i am giving 4000 to that column
So in case of SQL any drwbacks are there for this approach. Meaning my 3900 space will not be used so will it a wrong thing or we can declare it as ,,, it will put no effect???
or what are the drawback??

View 3 Replies View Related

Urgent: How To Drop Identity Nature Of A Column Using T-sql(Sql Server 7).

Dec 19, 2000

I have a table with a identity column in sql server 7 database. Now i need to update this identity column. Directly i couldn't able to update this column since it is an identity column. So, i like to drop this identity nature first and then update it is easy to update it. For this purpose, I need a Transact-sql script. Please Let me know if you have any thoughts on this. Thanks.

View 5 Replies View Related

SQL 2012 :: Drop All The Auto Generated Column Statistics?

Dec 29, 2014

My question: Is it okay to drop all the auto generated column statistics? (for the following scenario)

- I am cleaning up unnecessary objects (tables, unused indexes, overlapping statistics etc) from databases and found out there are more than 1400 auto generated column statistics on one database (lets call it A).
- Database A was used to be our reporting database but from last several years we are using database B for reporting. DB A has all the historical data while DB B only has valid records.
- We are updating all the column statistics with full scan nightly on database A and it is talking almost 2.5 hours to do that. Now I want to drop all the "unnecessary" statistics those were created when DB A was reporting database and they are no longer in use. There is no way to know the creation date of the column statistics that I know of. Statistics "last update date" is of no use because of our nightly job. So I was thinking of dropping all the auto generated column statistics and let the sql server create as it needs from now.

View 0 Replies View Related

Please Help!! How To Find Space At End Of Data In A Column

May 14, 2008



I need a query that checks each row in a column (hardness) to see if the last character is a "space". The column holds numbers (73.45) but is a varchar 50 type. It will always be the 5th character but it would be nice to not make this assumption. Please help!!
Thanks.

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved