In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article will explain in detail how to modify the listing in sqlserver. The content of the article is of high quality, so the editor shares it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
The code is as follows: EXEC sp_rename 'table name. [original column name]', 'new column name', 'column' Transact-SQL reference sp_rename changes the name of a user-created object in the current database, such as a table, column, or user-defined data type. The syntax sp_rename [@ objname =] 'object_name', [@ newname =]' new_name' [, [@ objtype =] 'object_type'] parameter [@ objname =]' object_name' is the current name of the user object (table, view, column, stored procedure, trigger, default value, database, object, or rule) or data type. If the object to be renamed is a column in the table, the object_name must be in the form of table.column. If you are renaming an index, the object_name must be in the form of table.index. Object_name is of type nvarchar (776) with no default value. [@ newname =] 'new_name' is the new name of the specified object. The new_name must be part of the name and follow the rules for identifiers. Newname is of type sysname and has no default value. [@ objtype =] 'object_type' is the type of object to be renamed. Object_type is of type varchar (13), and its default value is NULL. The following values can be taken. The value describes the column that COLUMN wants to rename. DATABASE user-defined database. Use this option when you want to rename the database. INDEX user-defined index. The type of project that OBJECT tracks in sysobjects. For example, OBJECT can be used to rename objects such as constraints (CHECK, FOREIGN KEY, PRIMARY/UNIQUE KEY), user tables, views, stored procedures, triggers, and rules. The user-defined data type that USERDATATYPE adds by executing sp_addtype. Return code value 0 (successful) or non-zero numeric (failed) comments can only change the object name or data type name in the current database. The names of most system data types and system objects cannot be changed. When you rename a view, the information in the sysobjects table about the view is updated. When you rename a stored procedure, the information in the sysobjects table about the procedure is updated. Whenever you rename a PRIMARY KEY or UNIQUE constraint, sp_rename automatically renames the associated index. If the renamed index is associated with a PRIMARY KEY constraint, sp_rename also automatically renames the primary key. After important renaming of stored procedures and views, clear the procedure cache to ensure that all related stored procedures and views are recompiled. Because neither the stored procedure nor the view stores data, both objects can be quickly deleted and rebuilt. For best results when renaming a text object, delete and recreate the object with its new name. Permissions members of the sysadmin fixed server role, members of the db_owner and db_ddladmin fixed database roles, or object owners can perform sp_rename. Only members of the sysadmin and dbcreator fixed server roles can execute sp_rename with "database" as an object_type. Example A. The following example renames the table customers to custs. EXEC sp_rename 'customers',' custs' B. Rename a column the following example renames the column contact title in table customers to title. EXEC sp_rename 'customers. [contact title]', 'title',' COLUMN' see ALTER TABLE CREATE DEFAULT CREATE PROCEDURE CREATE RULE CREATE TABLE CREATE TRIGGER CREATE VIEW data type SETUSER sp_addtype sp_depends sp_renamedb system stored procedures Note: system data tables cannot be changed
On how to modify the column name in sqlserver to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.