SP in Fundamental level:
SP_RENAMEDB: Here SP stands for Stored Procedure. This stored procedure is used
to change the name of the existing database.
Syntax:
SP_RENAMEDB ‘OLD DATABASENAME’, ‘NEW DATABASENAME’
E.g.: SP_RENAMEDB ‘NRSTT’, ‘NRSTTS’
The above
statement renames (changes the database name) NRSTT to NRSTTS
SP_RENAME: This stored procedure is used for changing the name of the table
and for changing the name of the column
i. Syntax to change the
name of the table
SP_RENAME ‘OLD TABLENAME’, ‘NEW TABLENAME’
E.g. SP_RENAME ‘EMP’, ‘EMPLOY’
The above stored
procedure changes the name of EMP table to EMPLOY
ii. Syntax to change the
name of the column
SP_RENAME ‘TABLE.OLDCOLUMN NAME’, ‘NEW COLUMNNAME’
E.g. SP_RENAME ‘STUDENT.ADR’, ‘ADDRESS’
The above stored
procedure changes the name of ADR column to ADDRESS in STUDENT table.
SP_HELP: This stored procedure is used to display the description of a
specific table.
Syntax: SP_HELP
TABLENAME
E.g.: SP_HELP
EMP
The above stored
procedure displays the description of EMP table
SP_DATADASES: This Stored procedure displays the list of databases available in
SQL Server.
Syntax:
SP_DATABASES
SP_TABLES: This stored procedure displays the list of tables available in the
current database.
Syntax:
SP_TABLES
SP_HELPDB: This stored
procedure is used to display the description of
master and log data file information of a specific database
Syntax:
SP_HELPDB Database-Name
Ex: SP_HELPDB SAMPLE
SP_SPACEUSED: This stored
procedure is used to find the memory status of the current database
Syntax:
SP_SPACEUSED
No comments:
Post a Comment