Functions

  • How can i make this into a function, i understand you cannot use the EXEC command within a function, i will be passing a postcode var.

    I want to be able to return the LAT and LNG fields in a SELECT Statement, these can be in one field if necessary or i create 2 functions for each.

    declare @geo varchar(max)

    declare @cmd varchar(max)

    declare @lat varchar(max)

    set @cmd = 'select LAT,LNG from COMBINED_LOCATIONS where KEYWORD = '''''+ @postcode + ''''''

    set @geo = 'SELECT top 1 * FROM OPENQUERY(LOCATION,''' + @cmd +''')'

    exec (@geo)

    thanks

  • Where is LOCATION located?

    Maybe you can use synonym instead?


    N 56°04'39.16"
    E 12°55'05.25"

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply