Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7917259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:05:06+00:00 2026-06-03T15:05:06+00:00

In my SQL Server (2008 R2) on Azure, there’s a table containing a lot

  • 0

In my SQL Server (2008 R2) on Azure, there’s a table containing a lot of geographical Points (latitude/longitude):

CREATE TABLE MyPoints
(
  Region uniqueidentifier NOT NULL,
  Number int NOT NULL,
  Position geography NOT NULL,
  CONSTRAINT PK_MyPoints PRIMARY KEY(Region, Number)
)

Now I want to create a Polygon from this points to determine, which of my stores are located in the area defined by the points.

Is there a native and fast way to build a polygon from the given points in T-SQL? The solutions I found are using the STGeomFromText/STGeomFomWKB methods to create a polygon, which seems very cumbersome and slow to me.

Something like:

SET @POLY = geometry::STPolyFromPoints(SELECT Position FROM MyPoints)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T15:05:08+00:00Added an answer on June 3, 2026 at 3:05 pm

    As far as I know, there is no native function that takes a table as parameter and converts that to a polygon.

    Your best is to combine a scalar User Defined Function to concatenate a column of results into a single comma seperated string with the STPolyFromText that you have already read about.

    UDF to Concatenate Column to CSV String

    MSDN – STPolyFromText

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

SQL Server 2008 R2: normally, we create our table, and stored procedure, and grant
SQL Server 2008 R2 Why create table A ( id int, primary key nonclustered
In Sql Server 2008, when I create a table without schema prefix: create table
I am trying to migrate a database from SQL Server 2008 to SQL Azure.
SQL Server is SQL Azure, basically it's SQL Server 2008 for normal process. I
IN SQL Server 2008 is there a way to generate a report as to
SQL Server 2008. Is it possible to create Change Data Capture (or Change Tracking)
SQL Server 2008: DECLARE @MyTable TABLE( PersonID INT NOT NULL, Person2ID INT NOT NULL,
In SQL Server 2008, we can define a table type and use it as
In Sql Server 2008 I have a DB table, and the data includes a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.