Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CREATE TABLE AS

Status
Not open for further replies.

atiqraza

Programmer
Jan 9, 2007
24
US
Any Reason why the Query

"CREATE TABLE AS" is not working in sql server 2005. I am trying to create a table from the result return of a query.
I am using the simple format
CREATE TABLE TABLE_NAME AS select * from table1

it keeps giving me this error

Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'as'.

 
The correct syntax would be...

select * Into Table_Name from table1

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Hey George,

Thnx for the reply but i am not using a table i am using a querry's return to create the new table, for some reason this syntax does not support it...OR does it ?
 
Do you want to create a View?

CREATE [!]VIEW[/!] TABLE_NAME AS select * from table1




-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top