Solved

sql - select into

Posted on 2014-10-14
6
227 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

863 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

20 Experts available now in Live!

Get 1:1 Help Now