[英]Parse Failed using SQL Server Migration Assistant
I'm trying to convert a MySQL database to Sql Azure. 我正在尝试将MySQL数据库转换为Sql Azure。 When I load the metadata of one of my databases, I get parsing failed error:
加载其中一个数据库的元数据时,出现解析失败错误:
MySql Server Object Collector error: function : pointInPoly Loading SQL definition or parsing failed for function 'pointInPoly'.
MySql Server对象收集器错误:function:pointInPoly函数'pointInPoly'的加载SQL定义或解析失败。
the code of the function is : 该函数的代码是:
BEGIN
DECLARE p POINT;
DECLARE poly POLYGON;
DECLARE n INT DEFAULT 0;
DECLARE pX DECIMAL(9,6);
DECLARE pY DECIMAL(9,6);
DECLARE ls LINESTRING;
DECLARE poly1 POINT;
DECLARE poly1X DECIMAL(9,6);
DECLARE poly1Y DECIMAL(9,6);
DECLARE poly2 POINT;
DECLARE poly2X DECIMAL(9,6);
DECLARE poly2Y DECIMAL(9,6);
DECLARE i INT DEFAULT 0;
DECLARE result INT(1) DEFAULT 0;
SET p = GEOMFROMTEXT(in_point);
SET poly = GEOMFROMTEXT(in_polygon);
IF ISNULL(p) OR ISNULL(poly) THEN
RETURN -2;
END IF;
SET pX = X(p);
SET pY = Y(p);
SET ls = ExteriorRing(poly);
SET poly2 = EndPoint(ls);
SET poly2X = X(poly2);
SET poly2Y = Y(poly2);
SET n = NumPoints(ls);
WHILE i<n DO
SET poly1 = PointN(ls, (i+1));
SET poly1X = X(poly1);
SET poly1Y = Y(poly1);
IF ( ( ( ( poly1X <= pX ) && ( pX < poly2X ) ) || ( ( poly2X <= pX ) && ( pX < poly1X ) ) ) && ( pY > ( poly2Y - poly1Y ) * ( pX - poly1X ) / ( poly2X - poly1X ) + poly1Y ) ) THEN
SET result = !result;
END IF;
SET poly2X = poly1X;
SET poly2Y = poly1Y;
SET i = i + 1;
END WHILE;
RETURN result;
END
What would be better? 有什么会更好? go with the convertion for all the other data and create a new MSSQL function for pointInPoly or fix the problem on the MySQL end and then do the migration complete ?
处理所有其他数据的转换,并为pointInPoly创建一个新的MSSQL函数,或者在MySQL端解决该问题,然后迁移完成吗?
Thing is, I'm totally new to MSSQL. 事实是,我对MSSQL完全陌生。 Not sure how it works with spatial data type.
不确定如何与空间数据类型一起使用。 The function supposes to return true if a point is inside a polygon, maybe there's a better way to do it on MSSQL?
该函数假定如果点在多边形内,则返回true,也许有更好的方法可以在MSSQL上执行此操作?
if it's native spatial data then use the spatial data datatypes! 如果是本地空间数据,则使用空间数据数据类型! Windows Azure SQL Databases support spatial data and is a better balanced datatype for what you're doing.
Windows Azure SQL数据库支持空间数据,并且可以更好地平衡您正在执行的数据类型。 to read more about SQL Server, SQL Databases on Azure and spatial data read following : http://msdn.microsoft.com/en-us/library/windowsazure/ff759530.aspx and http://technet.microsoft.com/en-us/library/bb933790(v=sql.105).aspx (it's available since SQL 2008 and up)
要了解有关SQL Server,Azure上的SQL数据库和空间数据的更多信息,请阅读以下内容: http : //msdn.microsoft.com/zh-cn/library/windowsazure/ff759530.aspx和http://technet.microsoft.com/cn -us / library / bb933790(v = sql.105).aspx (从SQL 2008及更高版本开始可用)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.