tags:

views:

29

answers:

1

Hi, I renamed the table by sp_RENAME (SQL SERVER 2008)

sp_RENAME 'dbname.scname.oldtblname' 'dbname.scname.newtblnam'

The resulting message (it was in black color - so I get it as just a warning or successful message) was something like "Caution: Changing any part of an object name could break scripts and stored procedures."

So after this command my table with 45 million records just disappeared and I don't have any backup. This was a new table.

:) Do you guys have any idea about bringing my table back? :)

p.s. Yeah, my smile is not ":(", because when the seriousness of the problem goes up the threshold, ":(" becomes ":)".

+1  A: 
  • What does this say?

SSMS does not refresh Object explorer automatically so it could be there

USE dbname
SELECT OBJECT_ID('scname.newtblnam')

You can change the name of an object or data type in the current database only. The names of most system data types and system objects cannot be changed.

You specified dbname so it's possible you have an object [dbname.scname.newtblnam] in dbo schema (or similar)

  • And did you do a backup first? Best practice before any (formal) schema changes, y'know

FWIW, I've never lost a table or other object using sp_rename

gbn
Yeah, it was under schema "scname", but name was "dbname.scname.newtblnam". And I did not realize that because of hundreds of tables. Thanks.
Azho KG