How can I convert this from MS SQL SERVER to MySQL?
/****** Object: StoredProcedure [dbo].[geolocation_refresh_geography] Script Date: 05/08/2012 22:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create procedure [dbo].[geolocation_refresh_geography]
as
update locations
SET geolocation = geography::STPointFromText('POINT(' + CAST([Longitude] AS VARCHAR(20)) + ' ' + CAST([Latitude] AS VARCHAR(20)) + ')', 4326)
where geolocation is null
GO
My code is causing errors on line 4, not sure why?
create procedure geolocation_refresh_geography()
BEGIN
update locations
SET geolocation = geography::STPointFromText('POINT(' + CAST(Longitude AS VARCHAR(20)) + ' ' + CAST(Latitude AS VARCHAR(20)) + ')', 4326)
where geolocation is null
END
Have you tried the MySQL Migration Toolkit?
http://dev.mysql.com/doc/migration-toolkit/en/mysql-migration-toolkit-indepth-sourcedb-mssql.html
It is a bit tough to find these days but I believe you can also you MySQL Workbench to accomplish this.
http://www.mysql.com/products/workbench/
I would recommend just migrating your entire schema which should port the procedure for you.