SQL 2012中的LEFT或SUBSTRING函数错误
SQL 2012中的LEFT或SUBSTRING函数错误
我正在尝试执行以下的SQL查询:
SELECT TMP.*,COUNT(*) OVER () AS rCount FROM ( SELECT venueID, venueName AS venueName, venueSpanish AS spanish, venueAddress + ', ' + venueCity + ', ' + venueState + ' ' + venueZip AS venueAddress, venueLatLong AS coordinates, CONVERT(VARCHAR, venueEventDate, 101) + ' @ ' + CONVERT(VARCHAR,venueTime) AS dateAndTime, SUBSTRING(venueLatLong, 1, CHARINDEX(',', venueLatLong)-1) AS Lat, SUBSTRING(venueLatLong, CHARINDEX(',', venueLatLong) + 1, 1000) AS Lng, (round(3959 * acos (cos(radians('35.0935409')) * cos(radians(SUBSTRING(venueLatLong, 1, CHARINDEX(',', venueLatLong)-1))) * cos(radians(SUBSTRING(venueLatLong, CHARINDEX(',', venueLatLong) + 1, 1000)) - radians('-85.0856761')) + sin(radians('35.0935409')) * sin(radians(SUBSTRING(venueLatLong, 1, CHARINDEX(',', venueLatLong)-1)))), 1, 1)) AS distance FROM meetUpMarkers) TMP WHERE distance < 30
然而,当我执行时,出现以下错误:
Msg 537, Level 16, State 2, Line 1
Invalid length parameter passed to the LEFT or SUBSTRING function.
希望能得到帮助解决这个问题!