Tutorials Forums
     Tutorials Videos
        Sign Up Now For FREE
Welcome, Guest
Username Password: Remember me
SQL SERVER HELP, SQL SERVER TUTORIALS, SQL SERVER PROGRAMMING, SQL SERVER CODE


SQL Server is a relational DMBS written for the Windows platform by Microsoft. SQL Server is a high-end and high-performance solution, for applications that interact with a database. Its use has been increasing because of the number of web applications that feature a data base back end.
  • Page:
  • 1

TOPIC: Renaming a Table

Renaming a Table 04 Feb 2010 14:19 #257

Introduction

To rename a table using code, execute the sp_rename stored procedure using the following formula:

sp_rename ExistingTableName, TableNewName;

Here is an example:

sp_rename 'StaffMembers', 'Employees';
GO

In this case, the interpreter would look for a table named StaffMembers in the current or selected database. If it finds it, it would rename it Employees. If the table doesn't exist, you would receive an error.
  • CE
  • OFFLINE
  • Administrator
  • Posts: 197
  • Karma: 78
CodersEngine
  • Page:
  • 1
Time to create page: 0.17 seconds