Link to home
Start Free TrialLog in
Avatar of WSU-CPD
WSU-CPD

asked on

SQL statement error of "incorrect syntax near the keyword 'as'"

Why is this sql statement throwing an error of "incorrect syntax near the keyword 'as'" CREATE TABLE [TempTable] AS (Select * From [Direct_Construction] where [PID] = @LastPID)
Parameter of @LastPID is being supplied

Avatar of Ephraim Wangoya
Ephraim Wangoya
Flag of United States of America image

What exactly do you want to do, Create a table then insert data into it
ASKER CERTIFIED SOLUTION
Avatar of derekkromm
derekkromm
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ricksteele
ricksteele

CREATE TABLE expects a set of column definitions.  Try this:

Select *
INTO [TempTable] 
From [Direct_Construction] 
where [PID] = @LastPID

Open in new window


Not sure off the top of my head if you can do this with Select *, you might have to pick some columns.
Avatar of WSU-CPD

ASKER

Thank you!  I have been beating my head against the wall on this one.  Knew it was simple.  Thanks!