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 7050085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:06:01+00:00 2026-05-28T03:06:01+00:00

Issue: When executing @somegeog.STWithin(@othergeog) I get the execption: Msg 6506, Level 16, State 10,

  • 0

Issue:

When executing @somegeog.STWithin(@othergeog) I get the execption:

Msg 6506, Level 16, State 10, Line 5
Could not find method 'STWithin' for type 'Microsoft.SqlServer.Types.SqlGeography' in assembly 'Microsoft.SqlServer.Types'

Background:

I am working with SQL Server (2008 R2) Geography data for the first time. I have a list of points in a table, and I want to retrieve those in a given area. I intend to write a stored procedure that accepts latitude and longitude bounds for the area.

I can write this procedure easily by extracting the latitude and longitude from the stored geography points, but I was hoping to let the inbuilt functionality do the work. After googling the topic for a while, I found the STWithin method, but even using Microsoft’s example, I get an error claiming the method doesn’t exist.

MS Example from link:

DECLARE @g geography;
DECLARE @h geography;
SET @g = geography::Parse('POLYGON ((-120.533 46.566, -118.283 46.1, -122.3 47.45, -120.533 46.566))');
SET @h = geography::Parse('CURVEPOLYGON (COMPOUNDCURVE (CIRCULARSTRING (-122.200928 47.454094, -122.810669 47.00648, -122.942505 46.687131, -121.14624 45.786679, -119.119263 46.183634), (-119.119263 46.183634, -119.273071 47.107523), CIRCULARSTRING (-119.273071 47.107523, -120.640869 47.569114, -122.200928 47.454094)))');
SELECT @g.STWithin(@h);

Can somebody please explain what I’m doing wrong?

Thanks in Advance!

  • 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-05-28T03:06:02+00:00Added an answer on May 28, 2026 at 3:06 am

    I think the example you are looking at applies to SQL Server 2012. Try the example here: http://technet.microsoft.com/en-us/library/bb933991.aspx

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

Sidebar

Related Questions

I am having an issue related to executing a .Net dll from a classic
I have been getting an intermittent issue when executing to_number function in the where
I basically have the exact same problem as here: http://stackoverflow.com/questions/2416155/issue-in-executing-spring-web-project-in-eclipse-on-tomcat-server but the fix for
This is an issue with Javascript executing linearly on a single thread. using setTimeout(function(){},time);
I'm having a performance issue with a select statement I'm executing. Here it is:
this shell explain the issue , after executing the .sh file halt and nothing
I have the following code compiles without issue. Of course, I get an invalid
I have an issue executing a package via the API at Microsoft.SqlServer.Dts.Runtime. I have
I'm having an issue executing jruby from the mingw git bash shell in windows.
I am facing an issue while executing queries.I use the same resultSet and statement

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.