Solved

sql - select into

Posted on 2014-10-14
6
225 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
  • 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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now