views:

90

answers:

1

Hi,

I have renamed a table using

Exec sp_rename 'table1','dbo.table_new'

the table got renamed but when i do select * from dbo.table_new, its saying Invalid object name

but when i do select name,* from sysobjects where name like '%dbo.table_new%' i can see the object exists.

How do i view the table now ?Do i need some right ?

A: 

because you should not write dbo. between '' because it will considered as string

now try write the following:

Exec sp_rename 'dbo.table_new','table_new'

it will work after that try selecting from the new table:

select * from Table_new

Edit:

try:

EXEC sp_rename N'[dbo].[dbo.table_new]', N'table_new'

and be careful when you want to use dbo in the string put it between []

Wael Dalloul
ya i tried its saying No item by the name of 'dbo.table_new' could be found in the current database 'db1'
Jebli
if you write:select name,* from sysobjects where name like 'dbo.table_new'you can see the record?
Wael Dalloul
yes i can see the details
Jebli