Opened 11 years ago

Last modified 11 years ago

#1148 new defect

concat function not working in webquery

Reported by: dbmuqs Owned by: dbmulg
Priority: minor Milestone: Post-NPGS Prod'n
Component: Middle Tier Version: 1.9.4 Server
Severity: Keywords:
Cc: Database Engine: N/A
Operating System: N/A

Description

concat is a new function in sqlserver 2012. It works in ssms but not webquery

Change History (3)

comment:1 by dbmuqs, 11 years ago

upon further review the problem seems to be with mixing numeric columns in the list of strings. The following 2 work in ssms and not in webquery:

select concat(accession_number_part1,accession_number_part2 ) as accf from accession where taxonomy_species_id=31789

select concat(accession_number_part1,cast(accession_number_part2 as nvarchar(20))) as accf from accession where taxonomy_species_id=31789

This was sqlservers example on a help page:

SELECT CONCAT ( 'Happy ', 'Birthday ', 11, '/', '25' ) AS Result

comment:2 by dbmuqs, 11 years ago

upon even further review webquery is not really using the concat function. It is really converting it to a + syntax. As such numerics must be cast as strings and a space needed after the comma e.g. #1 above:

select concat(accession_number_part1, accession_number_part2 ) as accf from accession where taxonomy_species_id=31789

#2 will not work
#3 needs quotes on the 11

comment:3 by Kurt Endress, 11 years ago

Component: Public Website App. → Middle Tier

This is happening inside the middle tier core SqlDataManager.cs in the mungeSql method. It replaces references like CONCAT('hi', 'there') into 'hi' + 'there'
Since SQL Server now supports CONCAT this could be removed since it's a bit buggy (no spaces around the comma causes problems).

Note: See TracTickets for help on using tickets.