Showing posts with label quotes. Show all posts
Showing posts with label quotes. Show all posts

Monday, March 19, 2012

Controlling Reporting Services Export

Hello,
I have a CSV export that needs some fields qualified by double quotes and
some that do not. How do I control this behavior in Reporting Services?
I have tried specifying a blank text qualifier in rsreportserver.config and
surrounding the applicable fields by double quotes but that doesn't work as
the double quote qualifier gets repeated.
TIA,
Ray
SS2K5On Jan 7, 4:06 pm, raybouk <rayb...@.discussions.microsoft.com> wrote:
> Hello,
> I have a CSV export that needs some fields qualified by double quotes and
> some that do not. How do I control this behavior in Reporting Services?
> I have tried specifying a blank text qualifier in rsreportserver.config and
> surrounding the applicable fields by double quotes but that doesn't work as
> the double quote qualifier gets repeated.
> TIA,
> Ray
> SS2K5
The quickest way to accommodate this is to use casting in SSRS (i.e.,
CStr(Fields!SomeFieldName.Value)). You would cast the fields that you
need to have quotes around. Also, you could use the format part of the
Properties tab for the fields you need to have the quotes around. An
expression similar to this might work: ="''#''" Another alternative
(more reliable, though more work) would be to use a StreamReader and
StreamWriter after the fact (after exporting the report to a given
format) to read in the report file into a string or stringbuilder,
then use String.Replace() (or String.Format()) and then output the
file with the quote identifiers for certain fields. Hope this helps.
Regards,
Enrique Martinez
Sr. Software Consultant

Friday, February 24, 2012

Contains Predicate and Double Quotes

I have been searching for an escape character or a way of escaping
double quotes that are actually in a string that I am using in the
contains predicate.

Here is an example

select *
from table
where contains(field, '"he said "what is wrong", that is what he
said"')

I need the double quotes in the string because they are part of the
text. Of course, Fulltext search raises the error

Server: Msg 7631, Level 15, State 1, Line 1
Syntax error occurred near 'what is wrong", that is what he said'.
Expected '' in search condition '"he said "what is wrong", that is
what he said"'.

If I remove the double quotes, the search does not return the proper
results.

Thanks in advance for the help
Bill"swtwllm" <swtwllm@.alum.iup.edu> wrote in message
news:c38d6cfb.0402201036.6cdf8d87@.posting.google.c om...
> I have been searching for an escape character or a way of escaping
> double quotes that are actually in a string that I am using in the
> contains predicate.
> Here is an example
> select *
> from table
> where contains(field, '"he said "what is wrong", that is what he
> said"')
> I need the double quotes in the string because they are part of the
> text. Of course, Fulltext search raises the error
> Server: Msg 7631, Level 15, State 1, Line 1
> Syntax error occurred near 'what is wrong", that is what he said'.
> Expected '' in search condition '"he said "what is wrong", that is
> what he said"'.
> If I remove the double quotes, the search does not return the proper
> results.
> Thanks in advance for the help
> Bill

It looks like this has been answered in
microsoft.public.sqlserver.fulltext - please don't post to multiple
newsgroups separately.

Simon|||swtwllm (swtwllm@.alum.iup.edu) writes:
> I have been searching for an escape character or a way of escaping
> double quotes that are actually in a string that I am using in the
> contains predicate.
> Here is an example
> select *
> from table
> where contains(field, '"he said "what is wrong", that is what he
> said"')
> I need the double quotes in the string because they are part of the
> text. Of course, Fulltext search raises the error
> Server: Msg 7631, Level 15, State 1, Line 1
> Syntax error occurred near 'what is wrong", that is what he said'.
> Expected '' in search condition '"he said "what is wrong", that is
> what he said"'.
> If I remove the double quotes, the search does not return the proper
> results.

I would expect doubling the quotes would help, but I don't use full-text
myself, so I don't know.

microsoft.public.sqlserver.fulltext may a better place to ask.

--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp