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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 getting error in creating table

Author  Topic 

born2acheive
Yak Posting Veteran

65 Posts

Posted - 2006-12-05 : 05:44:30
hi,

i want to create table using another table but i am getting the following error.

Server: Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'AS'.

my query is:


CREATE TABLE errorlog
AS SELECT * FROM log where 1=0
becos i a trying to copy the structure of the table log to table errorlog.please rectify my problem,please

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-12-05 : 05:47:02
Are you using ORACLE?

In SQL Server you should use

Select * into errorlog from log where 1=0


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

born2acheive
Yak Posting Veteran

65 Posts

Posted - 2006-12-05 : 05:53:57
hi madhivanan thankyou for you reply
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-12-05 : 07:45:23
Note that this will not copy constraints/indexes/relationships from the original table.

Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-12-05 : 09:59:44
quote:
Originally posted by harsh_athalye

Note that this will not copy constraints/indexes/relationships from the original table.

Harsh Athalye
India.
"Nothing is Impossible"


Which is I forget to specify in my first reply

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -