Mapping Stored Procedure Parameters to different Types

427 views Asked by At

I'm trying to map some insert/update stored procedures to a table in EF. But one of my column types (string) in the stored procedure is different to the column in the table (geometry).

I have a Geometry column in the table that I want to populate in the stored procedure by passing it a string value.

Stored procedure:

CREATE PROCEDURE [dbo].[UpdatePLACE] 
    @globalid uniqueidentifier,
    @shapeString varchar(max) = null    
AS
BEGIN
    SET NOCOUNT ON;

    declare @shape as geometry  
    set @shape = geometry::STGeomFromText(@shapeString, 2193)

    UPDATE [dbo].[PLACE]
    SET [SHAPE] = @shape
    WHERE [globalid] = @globalid
END

So, is it possible to map a string to a geometry type and how?

0

There are 0 answers