• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 241
  • Last Modified:

sql - select into

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
VBdotnet2005
Asked:
VBdotnet2005
  • 3
  • 3
1 Solution
 
Haris DjulicCommented:
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
 
VBdotnet2005Author Commented:
Sorry, I am new. so the name of the temptable is not #temp1? Or a is the name of the temp table?
0
 
Haris DjulicCommented:
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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
VBdotnet2005Author Commented:
temp1, rigth?
0
 
Haris DjulicCommented:
yes, #temp1

Did you try my query?
0
 
VBdotnet2005Author Commented:
yes, it works. Thank you for your help.
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

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