c# - Escape double quotes in SQL 2005/2008 -
i have international company has been added, named "bla "blahblah" ltd. (the double quotes part of name. )
whenever user tries search company, entering "blah, or affect, search fails syntax error in sql server.
how can escape search not fail?
sample sql:
select c.companyid, c.companyname, c.dateadded, count(cm.maxid) numdirect russoundgeneral.dbo.company c left join russoundgeneral.dbo.companymax cm on (cm.companyid = c.companyid , cm.maxid not null) contains ( companyname, '"blah*' ) group c.companyid, c.companyname, c.dateadded order c.companyname asc
unfortunately, double-quotes have special meaning inside fti, if parameterize it, fti engine treats phrase delimiter. not sure there easy way include double-quotes in fti search. brackets special character, can encased in quotes treat query term - not afaik double-quotes.
update
a bit of searching suggests doubling quote "" may fix - worth try. personally, i'd inside db, since tsql implementation detail.
likewise, ' needs doubled '' before passing fti (completely separate tsql escaping),
Comments
Post a Comment