Solved

sql - select into

Posted on 2014-10-14
6
231 Views
Last Modified: 2014-10-14
Why do I get  this error below?
select top (10) *from customer_shipped does returns top 10

Msg 102, Level 15, State 1, Line 1
Incorrect syntax near ')'.

select * into #temp1 from (select top (10) *from customer_shipped)
0
Comment
Question by:VBdotnet2005
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 15

Accepted Solution

by:
Haris Djulic earned 500 total points
ID: 40380783
you need to name your "table" i.e.

select * into #temp1 from (select top (10) *from customer_shipped) a 

Open in new window


This should work
0
 

Author Comment

by:VBdotnet2005
ID: 40380789
Sorry, I am new. so the name of the temptable is not #temp1? Or a is the name of the temp table?
0
 
LVL 15

Expert Comment

by:Haris Djulic
ID: 40380804
Notice the letter "a" i added to after the parenthesis.. Since you are using query as a "table" you need to name it..

and yes your new temp table is named right..
0
Backup Solution for AWS

Read about how CloudBerry Backup fully integrates your backups with Amazon S3 and Amazon Glacier to provide military-grade encryption and dramatically cut storage costs on any platform.

 

Author Comment

by:VBdotnet2005
ID: 40380808
temp1, rigth?
0
 
LVL 15

Expert Comment

by:Haris Djulic
ID: 40380811
yes, #temp1

Did you try my query?
0
 

Author Comment

by:VBdotnet2005
ID: 40380819
yes, it works. Thank you for your help.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how the fundamental information of how to create a table.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question