We help IT Professionals succeed at work.

Table Copy-- Invalid Object Name

rghunt
rghunt asked
on
398 Views
Last Modified: 2009-07-29
I have made back up tables before using:

Select * into Table2 from Table

But now I get an error message

Server: Msg 208, Level 16, State 1, Line 1
Invalid object name 'table2'.

Any ideas what the problem is?
Comment
Watch Question

CERTIFIED EXPERT

Commented:
"table" is reserved word, so "from table" wouldn't work. But the error message would be "invalid syntax". Is the statement exactly as you posted? what version of sql server?
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Commented:
I think we'll need more details on what you're trying to do, but as a sarter, try to use database name as probably it's not dbo, in which case it will not be picked by default:

Select * somedbo.Table2

next one, try to check your sysobject table:

select * from sysobject where name = 'table2'

or, if you're unsure about the syntax, try this:

select * from sysobject where name liek '%table%'

it will return all objects in your databse that have table in their names

Try this, and then we'll see what can be done.
Regards,
Yurich
AneeshDatabase Consultant
CERTIFIED EXPERT
Top Expert 2009

Commented:
Hi rghunt,

I think you should use the ownername.tablename here..

Aneesh R!

Commented:
run sp_tables to see if that table exists.

or like Aneesh said you need to used the fully qualified table name.



Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.