我正在尝试执行以下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
传递给LEFT或SUBSTRING函数的长度参数无效。
任何帮助都可以解决这个问题!
答案 0 :(得分:2)
可能就是这一行:
SUBSTRING(venueLatLong, 1, CHARINDEX(',', venueLatLong)-1) AS Lat
venueLatLong
中没有逗号,这导致-1
的长度
为什么不将纬度和经度存储在两个数字列而不是VarChar中?
答案 1 :(得分:2)
问题可能在于传递给doxygen {
generate_latex true
generate_html true
source projectDir
include '*.java'
include '**/*.md'
use_mdfile_as_mainpage new File(projectDir, 'readme.md')
full_path_names false
//Project related configuration options
project_logo new File(projectDir,'logo.png')
project_name 'Android'
outputDir new File(projectDir, 'docs/')
optimize_output_java true
markdown_support true
autolink_support true
subgrouping true
//Configuration options related to the input files
input_encoding 'UTF-8'
file_paterns '*.java','*.md'
recursive true
//Configuration options related to source browsing
strip_code_comments true
references_link_source true
source_tooltips true
verbatim_headers true
//Configuration options related to the alphabetical class index
alphabetical_index true
cols_in_alpha_index 5
//Configuration options related to the HTML output
html_header new File(projectDir,'header.html')
html_footer new File(projectDir,'footer.html')
html_stylesheet new File(projectDir,'custom.css')
html_extra_files new File(projectDir,'favicon.ico')
generate_treeview true
函数的参数。在查询中重复此条件。
substring
如果CHARINDEX(',', venueLatLong)
不包含venueLatLong
,则,
的此参数无效。
可以通过包含substring
子句来避免这种情况。
where