checking for strings in open row set

  • Hello All,

    I am trying to connect to the table which is in different server. I am using open row set for that. With open row set I am trying to connect to the table and filter the results with some conditions and load this result set into a temp table. But at the end near the where condition I have filter for strings.It is showing an error near the 'sbrpt%' and '%Subreport%'. Can anyone tell me how to use these strings when I am using open rowset.

    Here is what I am doing

    select * into #catalog

    from OPENROWSET('SQLOLEDB', 'servername'; 'userid'; 'pwd',

    'select [ItemID]

    ,[Path]

    ,[Name]

    ,[ParentID]

    ,[Type]

    ,[Content]

    ,[Intermediate]

    ,[SnapshotDataID]

    ,[LinkSourceID]

    ,[Property]

    ,[Description]

    ,[Hidden]

    ,[CreatedByID]

    ,[CreationDate]

    ,[ModifiedByID]

    ,[ModifiedDate]

    ,[MimeType]

    ,[SnapshotLimit]

    ,[Parameter]

    ,[PolicyID]

    ,[PolicyRoot]

    ,[ExecutionFlag]

    ,[ExecutionTime]

    FROM [ReportServer].[dbo].[Catalog] where type = 2

    and c.name not like 'sbrpt%' and c.path not like '%Subreport%''

    )

  • You need to double your single quotes.

    ... like ''sbrpt%'' and c.path not like ''%Subreport%'''

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • Got it. Thank you so much.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply