Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
sccrsurfer
Starting Member
43 Posts |
Posted - 2013-02-07 : 10:43:57
|
Hi Guys, I've tried two different approaches to creating a backup table. The end result I want is an exact duplicate the sample name below "existing_table."Using SQL 2005 btw with 2008 management studio. When I try:CREATE TABLE [dbName].[dbo].[backup]AS SELECT * FROM [dbName].[dbo].[existing_table]I get a syntax error saying this: Msg 156, Level 15, State 1, Line 2Incorrect syntax near the keyword 'AS'.Then I tried this: SELECT * INTO [TMCCommon].[dbo].[backup]FROM [TMCCommon].[dbo].[existing_table]It said that all of the rows were affected, but the new table I want created "backup" is nowhere to be found! And it says when I try to run the query again that the "backup" object already exists. Any clue on what's going on? Thanks! |
|
mandm
Posting Yak Master
120 Posts |
Posted - 2013-02-07 : 10:47:52
|
Management Studio has a bit of quirk where it won't show a new object until you refresh. Go to the tables in the left nav then right click and choose refresh. Your table should now appear. |
|
|
sccrsurfer
Starting Member
43 Posts |
Posted - 2013-02-08 : 09:33:41
|
Boy do I feel sheepish. That was it! Thanks. |
|
|
mandm
Posting Yak Master
120 Posts |
Posted - 2013-02-08 : 11:02:15
|
You're welcome.No need to feel sheepish. It fooled me once too. |
|
|
|
|
|