Here is the senerio,I am connected to a SQL Server database (2012) using Oralce SQl Developer(4.1.3).here is the sql statement i plan to execute.
select FORMAT(createDate,'yyyyMMdd') AS date,
SUM(bb_cnt) AS 'Broadband Service',
SUM(tel_cnt) AS 'Telephone Service',
SUM(bb_tel_cnt) AS 'Broadband & Telephone Service',
from (select createDate,
CASE WHEN ServicePlan LIKE '%Broadband Service%' then 1 else 0 end AS bb_cnt,
CASE WHEN ServicePlan LIKE 'Telephone Service%' OR ServicePlan LIKE '%, Telephone Service%' then 1 else 0 end AS tel_cnt,
CASE WHEN ServicePlan LIKE '%Broadband & Telephone Service%' then 1 else 0 end AS bb_tel_cnt,
from EFormRegisterationData
) a
group by FORMAT(createDate,'yyyyMMdd') order by 1;
the problem is I cannot seem to get SQL Developer to recognize the & as a literal ampersand. I've tried escaping it numerous ways, but it always thinks it is a variable,I google the question and finds out this useful link, SQL Developer, SQL Server and the ampersand,in this article,SQL Developer Team mentioned the walkaround," before your SQL Server query. SET DEFINE OFF; ",I tried,but the SQL Developer tells it has syntax error,I'm at a loss,any suggestion will be appreciated,thanks.
plus:exact the same sql works fine when using DataGrip connected to the SQL Server 2012,it's so werid, so I think the problem is client software,not the sql statement itself.