locked
STBuffer with variable RRS feed

  • Question

  • Hello,

    i'm triying to use a variable to set the distance's search in a sql server query:

    Tbl1.[Geometry].STBuffer(@distance)).STContains(tbl2.[Geometry])

    The quey never end and the db go to timeout.

    If i replace @distance with a numeric value the query ends in few seconds.

    You can help me?

    Federico

    Friday, June 10, 2016 11:33 AM

All replies

  • A few things to check...

    What is the value of @distance when the query times out? Is it the same as the hardcoded value you used?

    Is the estimated query plan the same for both?

    Have you tried breaking the query in two (one does the STDistance, the other does the STContains) to see if that helps?

    Friday, June 10, 2016 3:55 PM