table-rename

Determine Which Objects Reference a Table in SQL Server

不羁的心 提交于 2019-12-20 08:48:30
问题 I work with SQL Server 2008 and I have a database that has more than 1500 columns and about 500 stored procedures and ... . I want to rename a table that has several relations and is referenced in many stored procedure and views and ... . How to I can get all Items in database that has a relation with this table? Thanks. 回答1: If you need to find database objects (e.g. tables, columns, triggers) by name - have a look at the FREE Red-Gate tool called SQL Search which does this - it searches

monitor renaming a table in a sql server database with trigger

本秂侑毒 提交于 2019-12-11 15:27:34
问题 I have a trigger that logs on changes to the metadata of tables in a database. it saves the logs in another table called tblMonitorChange . When i rename a table no triggers is generated. this is the trigger : USE ReportServer GO CREATE TRIGGER trgMonitorChange ON DATABASE FOR CREATE_TABLE, ALTER_TABLE, DROP_TABLE , RENAME_TABLE AS set nocount on declare @EventType varchar(100) declare @SchemaName varchar(100) declare @ObjectName varchar(100) declare @ObjectType varchar(100) SELECT @EventType

sql:need to change constraint on rename table?

瘦欲@ 提交于 2019-12-09 04:51:51
问题 i have change name of table through procedure sp_rename.Do i need to change fk constraint of child table? 回答1: Constraints and indexes will be automatically renamed, but you will need to manually do rename work in stored procedures, triggers, user-defined functions, and views that reference the table. See the documentation on MSDN. 回答2: No, the table name change will have also updated the apporpriate Metadata in the system catalogs and so the constraint will still be referencing the correct

How do I rename a model with Django?

混江龙づ霸主 提交于 2019-12-08 01:04:36
问题 Let's say I have this model: class Foo(models.Model): name = models.CharField(max_length=255) I want to rename it to Bar . What steps should I take? And how do I deal with The following content types are stale prompt? 回答1: In my particular case it was like so: Rename model class name and all its references. Run ./manage.py makemigrations . Inspect your database for references from tables your apps own. Ordinary references and references via django_content_type table. Deal with them

what is the difference between 'alter table rename' and 'rename table'?

半腔热情 提交于 2019-12-07 07:13:28
问题 I am using MySQL. Here's an example, I want to rename a table A to B, so what's the difference between following statement: alter table A rename to B; and this one: rename table A to B; Can anyone give a detail compare between them? Is it vary based on different engine? 回答1: As documented under ALTER TABLE Syntax: For ALTER TABLE tbl_name RENAME TO new_tbl_name without any other options, MySQL simply renames any files that correspond to the table tbl_name without making a copy. (You can also

what is the difference between 'alter table rename' and 'rename table'?

笑着哭i 提交于 2019-12-05 13:23:07
I am using MySQL. Here's an example, I want to rename a table A to B, so what's the difference between following statement: alter table A rename to B; and this one: rename table A to B; Can anyone give a detail compare between them? Is it vary based on different engine? As documented under ALTER TABLE Syntax : For ALTER TABLE tbl_name RENAME TO new_tbl_name without any other options, MySQL simply renames any files that correspond to the table tbl_name without making a copy. (You can also use the RENAME TABLE statement to rename tables. See Section 13.1.32, “ RENAME TABLE Syntax” .) Any

Determine Which Objects Reference a Table in SQL Server

▼魔方 西西 提交于 2019-12-02 17:31:29
I work with SQL Server 2008 and I have a database that has more than 1500 columns and about 500 stored procedures and ... . I want to rename a table that has several relations and is referenced in many stored procedure and views and ... . How to I can get all Items in database that has a relation with this table? Thanks. If you need to find database objects (e.g. tables, columns, triggers) by name - have a look at the FREE Red-Gate tool called SQL Search which does this - it searches your entire database for any kind of string(s). It's a great must-have tool for any DBA or database developer -

Renaming multiple columns in one statement with PostgreSQL

戏子无情 提交于 2019-11-30 14:31:17
问题 Is it possible to rename multiple columns in a single statement, something along the lines of: ALTER TABLE Users RENAME COLUMN userName TO user_name, RENAME COLUMN realName TO real_name; 回答1: No. While other actions can be combined, that's not possible with RENAME . The manual: All the forms of ALTER TABLE that act on a single table, except RENAME , SET SCHEMA , ATTACH PARTITION , and DETACH PARTITION can be combined into a list of multiple alterations to be applied together. Since RENAME is

Renaming multiple columns in one statement with PostgreSQL

女生的网名这么多〃 提交于 2019-11-30 10:54:37
Is it possible to rename multiple columns in a single statement, something along the lines of: ALTER TABLE Users RENAME COLUMN userName TO user_name, RENAME COLUMN realName TO real_name; No. While other actions can be combined, that's not possible with RENAME . The manual: All the forms of ALTER TABLE that act on a single table, except RENAME , SET SCHEMA , ATTACH PARTITION , and DETACH PARTITION can be combined into a list of multiple alterations to be applied together. Since RENAME is a tiny operation on a system catalog, there is no harm in running multiple statements. Do it in a single

Rename Oracle Table or View

浪尽此生 提交于 2019-11-28 21:01:34
What is the syntax to rename a table or view in Oracle? ALTER TABLE mytable RENAME TO othertable In Oracle 10g also: RENAME mytable TO othertable To rename a table you can use: RENAME mytable TO othertable; or ALTER TABLE mytable RENAME TO othertable; or, if owned by another schema: ALTER TABLE owner.mytable RENAME TO othertable; Interestingly, ALTER VIEW does not support renaming a view. You can, however: RENAME myview TO otherview; The RENAME command works for tables, views, sequences and private synonyms, for your own schema only. If the view is not in your schema, you can recompile the