Sp_rename
May 16, 2008Does anyone know how to do a sp_rename thats not held to the current database?
View 3 RepliesDoes anyone know how to do a sp_rename thats not held to the current database?
View 3 RepliesHi There,
Why does the following statement doesn't work when i execute this in the master database? How should it be altered?
EXEC sp_rename 'REPLICATIETEST.dbo.USERLOG2','REPLICATIETEST.dbo.USERLOG
Kindest Regards
SQL Server 7.0I have a stored procedure that builds some tables. To minimize down time(it is the backend for a website), I build the tables into temp (not #temp)tables, drop and rename the tables with SP_Rename. On ONLY one of the tablerenames (1 of 8), I get the following Error:sp_rename error: 15248 Severity 11Error: The parameter @oldname is either ambiguous or the claimed @itemtype((null)) was wrong. It refers to Line 256.Again I get no errors doing the exact same process on the other 7 tables.Anybody have any ideas?Barry
View 3 Replies View RelatedSql 7. SP 2
After renaming a table Table_tbl to Table_old
and vise-versa.
When selecting from Table_old (for yesterday's data)
I get errors stating that Page belongs to Table_tbl.
Any suggestions on how to successfully rename Old to New, etc.
And not have cross-linked data pages??
I am trying to use DDL triggers to detect all changes to a table.
Sometimes a user directly or (more likely) through the SQL Server Management Studio GUI renames a column via sp_rename.
I can't seem to figure out how to detect such renames using a DDL trigger. Is there any way or is this a limitation of the DDL trigger system?
BooksOnline indicates that sp_rename can still be used to rename constraints such as primary keys, foreign keys, defaults, etc. in SQL Server 2005. However, when I try to do so I get this:
"Either the parameter @objname is ambiguous or the claimed @objtype (object) is wrong."
After looking at the code for sp_rename, it looks like this problem might be related to another bit of apparent misbehavior on 2005's part: when I execute "select object_name()" with the Id number of a constraint, it returns the name, but when I execute "select object_id()" with the name of that same constraint, it returns null. Why is that?
Thanks,
Ron
Hi,
Recently I have been trying to write a script in order to redo this entire database, it's actually only about rectifying column and table names as well as a few erroneous relations, etc. The idea is that the actual data is okay it's just the organization that is completely messed up (spaces in column and table names, etc.)
Anyway my problem is this, a part of this script is about mass-renaming columns and tables the code is as follows in the Query Analyzer:
Code Snippet
sp_rename 'DOMAINE.[Id DOMAINE]', 'ID_DOMAINE', 'COLUMN';
sp_rename 'DOMAINE.[Nom DOMAINE]', 'NOM', 'COLUMN';
When I barely analyze the code (Ctrl+F5) it gives me the following error:
Serveur : Msg 170, Niveau 15, État 1, Ligne 2
Ligne 2 : syntaxe incorrecte vers 'sp_rename'.
Which would roughly translate into:
Server : Msg 170, Level 15, State 1, Line 2
Line 2 : Incorrect syntax near 'sp_rename'
When I execute it, it gives the same error. Why does it do that when i give it the two lines while if i enter the lines one by one it works just fine. How is a SCRIPT supposed to work if I have to "baby-feed" every statement separately.
PS:
i am working on SQL Server 2000 (in Query Analyzer menu ?/About .. it says SQL Version 8.00.194