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

  • Home
  • SEARCH
  • 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 153321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T09:46:50+00:00 2026-05-11T09:46:50+00:00

I am trying to issue a SQL update statement with nHibernate (2.0.1GA) like this:

  • 0

I am trying to issue a SQL update statement with nHibernate (2.0.1GA) like this:

sqlstring = string.Format('set nocount on;update myusers set geo=geography::Point({0}, {1}, 4326) where userid={2};', mlat, mlong, userid); _session.CreateSQLQuery(sqlstring).ExecuteUpdate(); 

However I receive the following error: ‘geography@p0’ is not a recognized built-in function name.

I thought CreateSQLQuery would just pass the SQL I gave it and execute it…guess not. Any ideas on how I can do that within the context of nHibernate?

  • 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. 2026-05-11T09:46:51+00:00Added an answer on May 11, 2026 at 9:46 am

    I’m pretty sure I can tell you what is happening, but I don’t know if there is a fix for it.

    I think the problem is that the ‘:’ character is used by NHibernate to create a named parameter. Your expression is getting changed to:

    set nocount on;update myusers set geo=geography@p0({0}, {1}, 4326) where userid={2}; 

    And @p0 is going to be a SQL variable. Unfortunately I can’t find any documentation for escaping colons so they are not treated as a named parameter.

    If an escape character exists (my quick skim of the NHibernate source didn’t find one; Named parameters are handled in NHibernate.Engine.Query.ParameterParser if you want to spend a little more time searching), then you could use that.

    Other solutions:

    • Add an escape character to the source. You can then use a modified version of NHibernate. If you do this, you should submit your patch to the team so it can be included in the real thing and you don’t have to maintain a modified version of the source (no fun).
    • Create a user defined function in your DB that returns a geography::Point, then call your function instead of the standard SQL function. This seems like the quickest/easiest way to get up and running, but also feels a bit like a band-aid.
    • See if there is something in NHibernate Spatial that will let you programmatically add the geography::Point() [or edit the code for that project to add one and submit the patch to that team].
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get the following SQL statement to work: UPDATE myschema.tableA update_tableA SET
I'm having an issue trying to set variable in SQL in a stored procedure.
Ok so I've spent a couple hours trying to resolve this issue and have
I am trying to Update Schema on SQL Server CE 3.5 using Active Record
I'm using SQL Server 2000 and i'm trying to run an update query to
Ok, so I'm aware of this issue: When SET ANSI_NULLS is ON, all comparisons
I am running into quite an annoying issue while trying to deserialise a specific
Trying to debug an issue with a server and my only log file is
An odd issue that I have been trying to address in a project -
I am trying to debug a strange issue with users that have LogMeIn installed.

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.