Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 343
  • Last Modified:

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

0
WSU-CPD
Asked:
WSU-CPD
1 Solution
 
Ephraim WangoyaCommented:
What exactly do you want to do, Create a table then insert data into it
0
 
derekkrommCommented:
select * into [TempTable] from [Direct_Construction] where [PID] = @LastPID
0
 
ricksteeleCommented:
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.
0
 
WSU-CPDAuthor Commented:
Thank you!  I have been beating my head against the wall on this one.  Knew it was simple.  Thanks!
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now