我想换一些
decimals
到
varchar
但是他们得到了
圆形的
.
有人能告诉我为什么吗?
declare @UpperLeftLatitude DECIMAL,
@UpperLeftLongitude DECIMAL,
@BottomRightLatitude DECIMAL,
@BottomRightLongitude DECIMAL
SET @UpperLeftLatitude = 38.663
SET @UpperLeftLongitude = -122.857
SET @BottomRightLatitude = 37.795
SET @BottomRightLongitude = -121.219
DECLARE @SearchRectangleString VARCHAR(MAX);
SET @SearchRectangleString = 'POLYGON((' + CONVERT(VARCHAR(50), @UpperLeftLatitude) + ' ' + CAST(@UpperLeftLongitude AS VARCHAR(50)) + ','
+ CAST(@BottomRightLatitude AS VARCHAR(50)) + ' ' + CAST(@UpperLeftLongitude AS VARCHAR(50)) + ','
+ CAST(@BottomRightLatitude AS VARCHAR(50)) + ' ' + CAST(@BottomRightLongitude AS VARCHAR(50)) + ','
+ CAST(@UpperLeftLatitude AS VARCHAR(50)) + ' ' + CAST(@BottomRightLongitude AS VARCHAR(50)) + ','
+ CAST(@UpperLeftLatitude AS VARCHAR(50)) + ' ' + CAST(@UpperLeftLongitude AS VARCHAR(50)) + '))';
SELECT @SearchRectangleString
-------------------
POLYGON((39 -123,38 -123,38 -121,39 -121,39 -123))
(1 row(s) affected)
注:是的,我知道我的长/宽是错误的。我很快就换。