1 Version 4.0 -- 1/15/89 sp_addsegment
______________________________________________________________________
NAME: sp_addsegment
FUNCTION:
Define a segment on a database device in the current database.
SYNTAX:
sp_addsegment segname, devname
EXAMPLES:
sp_addsegment indexes, dev1
sp_addsegment Version 4.0 -- 1/15/89 2
______________________________________________________________________
This command creates a segment named indexes on the database dev-
ice named dev1.
PARAMETERS:
segname - is the name of the new segment. It is added to the
syssegments table of the database.
devname - is the name of the database device where segname will
be located.
COMMENTS:
o sp_addsegment defines segment names for database devices that
have been assigned to a specific database with an ALTER DATA-
BASE or CREATE DATABASE command. You must USE database before
you can use segment procedures in the database.
o Once a segment has been defined it may be used in the CREATE
3 Version 4.0 -- 1/15/89 sp_addsegment
______________________________________________________________________
TABLE and CREATE INDEX commands and sp_placeobject to place the
table or index on the segment.
o When a table or index is created on a particular segment, all
the subsequent data for the table or index will be located on
the segment.
o A database device may have more than one segment associated
with it.
o Segment names are unique in each database.
o Use the stored procedure sp_extendsegment to extend the range
of a segment to another database device used by the same data-
base.
o The system and default segments are mapped to each database
device included in a CREATE DATABASE or ALTER DATABASE command.
The logsegment is also mapped to each device, unless it is
placed on a separate device with the LOG ON extension to CREATE
sp_addsegment Version 4.0 -- 1/15/89 4
______________________________________________________________________
DATABASE or later use of sp_logdevice. Use sp_dropsegment to
un-map these segments, if desired.
o When ALTER DATABASE is used to extend a database on a device
already in use by that database, the segments mapped to that
device are extended as well.
MESSAGES:
The procedure was successful. There is now a segment named seg-
name in the current database.
The named device doesn't exist. It must be in sysdevices.
Although the device named as the devname parameter does exists in
master.dbo.sysdevices, is not used by the current database.
Therefore a segment cannot be defined that is associated with
it. Segments may only be defined on database devices used by
the database. The alter database command will extend a data-
base on a device listed in the master.dbo.sysdevices table.
You can't create a segment on a disk device that is dedicated to
5 Version 4.0 -- 1/15/89 sp_addsegment
______________________________________________________________________
the database log.
The segment name given as the segname parameter is not unique and
therefore disallowed.
A database can have only 31 segments. There are already 31 seg-
ments defined for the current database. You must drop a seg-
ment before you define a new one. Use sp_dropsegment to drop
a segment.
Segment names must follow the rules for legal identifiers. Iden-
tifiers must begin with a letter or an underscore character
(_) or pound sign (#). After the first character identifiers
may include letters, underscore (_), #, or $.
PERMISSIONS:
Execute permission to Database Owner and System Administrator.
TABLES USED:
syssegments, master.dbo.sysusages, master.dbo.devices
sp_addsegment Version 4.0 -- 1/15/89 6
______________________________________________________________________
SEE ALSO:
sp_extendsegment, sp_dropsegment, sp_placeobject, sp_helpdb,
sp_helpdevice, CREATE TABLE, CREATE INDEX, ALTER DATABASE, DISK
INIT