1 Version 4.0 -- 1/15/89 sp_dropsegment
______________________________________________________________________
NAME: sp_dropsegment
FUNCTION:
Drop a segment from a database, or drop a segment from a particu-
lar database device.
SYNTAX:
sp_dropsegment segname [, device]
EXAMPLES:
sp_dropsegment indexes
sp_dropsegment Version 4.0 -- 1/15/89 2
______________________________________________________________________
This command drops a segment from the current database.
sp_dropsegment indexes, dev1
This command un-maps the indexes segment from the database device
dev1.
PARAMETERS:
segname - is the name of the segment to be dropped.
device - is the name of the database disk device that you would
like the segment segname to no longer use. This parameter is
optional.
COMMENTS:
o A segment may be dropped if is not being referenced by any
3 Version 4.0 -- 1/15/89 sp_dropsegment
______________________________________________________________________
table or index in the current database.
o You can cause a segment to be no longer mapped onto a database
disk device by supplying the device name as the optional second
argument.
o When you don't supply the optional second argument device, the
segment is dropped from your current database. If you do sup-
ply a device name, then any reference by the segname segment to
device is dropped but the segment is not dropped.
o You can use the stored procedure sp_placeobject to change
future space allocations for a table or index from one segment
to another. In effect, this dereferences the original segment,
and you can drop that segment name.
MESSAGES:
The procedure was successful. There is no longer a segment named
segname in the current database.
sp_dropsegment Version 4.0 -- 1/15/89 4
______________________________________________________________________
The procedure was successful. The segment segname no longer
refers to database disk device device.
The segment you have tried to drop is not a segment. All seg-
ments for a database are listed in the syssegments table.
You can't drop a segment that is referenced by a table or index.
If you still want to drop the segment, you must redefine the
segment for the affected tables and indexes by using the
stored procedure sp_placeobject.
The segment you tried to drop from device isn't referenced by
segment segname. Run sp_helpsegment segname to list the dev-
ices that segname references.
The segment reference to device you have tried to drop is the
last device reference for segname. It's illegal to drop the
last disk device reference for a segment.
The current database doesn't use any disk fragments from device
device. Use sp_helpsegment to see which disk devices are
referenced by segname.
5 Version 4.0 -- 1/15/89 sp_dropsegment
______________________________________________________________________
PERMISSIONS:
Execute permission to Database Owner and System Administrator.
TABLES USED:
syssegments, sysindexes, master.dbo.sysusages
SEE ALSO:
sp_addsegment, sp_helpsegment, sp_placeobject