Quantcast
Channel: ฟอรัม Getting started with SQL Server
Viewing all articles
Browse latest Browse all 8428

Select by Location. Select Into.. No column was specified

$
0
0

Hello.. I am starting out as a new user with Sql Server Express 2012.

I'm using the information in the AdventureWorks2012 database and

http://msdn.microsoft.com/en-us/library/ff929109.aspx 

I can run a select by location from the Person.Address table as illustrated in the documentation.  I want to be able to run a 'SELECT INTO' and I'm stumped on the syntax.  

-- selecting around a point the 7 most closest around a defined point. USE AdventureWorks2012 GO DECLARE @g geography = 'POINT(-121.626 47.8315)';

SELECT TOP(7) SpatialLocation.ToString(), City INTO Person.AddressTest2 FROM Person.Address ORDER BY SpatialLocation.STDistance(@g) ;


Problem is in the incorporation of the 'INTO Person.AddressTest2.  I get the 'No column was specified for column1' ERROR.  How do I give a default name to the (No column name)?


Viewing all articles
Browse latest Browse all 8428

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>