Solved

sql - select into

Posted on 2014-10-14
6
229 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
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 

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

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.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

772 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