Re: XMLColumn.query



"CAUEEE" <CAUEEE@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:9C6C06B1-B6B7-45BE-A78B-B7D016DB606C@xxxxxxxxxxxxxxxx
--query1
DECLARE @Qry varchar(100)
SET @Qry = 'data(/FORMDATA/FD_SELECT3)'

select USE_PRSN_XSL_IPUT_VLU.query(@Qry) from xml_tab
where the_id=1
--

an error occurs when the query1 is executed.
should '.query' method's parameter should be a string literal?

Yes. As the error message says, "The argument 1 of the xml data type method
'query' must be a string literal."

how can I use variable(e.x @Qry) when I use .query method?

Use sp_executesql.

--
Brandon Berg
Software Design Engineer
Microsoft SQL Server


.



Relevant Pages

  • Re: Querying a database
    ... Alter Procedure spMyTest ... Declare @sCnt VarChar ... Declare @qry VarChar ... Set Nocount Off ...
    (microsoft.public.vb.database)
  • RE: Syntax for Table with Get Date?
    ... declare @tbName as nvarchar ... declare @Qry as nvarchar ... Due to large volume of data I am partitoning ... > show me with example/ Syntax how to create such table. ...
    (microsoft.public.sqlserver.programming)
  • Re: Cross tab date problem
    ... Open the query in design view. ... Choose Parameters on the Query menu. ... You must declare the parameter in a crosstab, but it is always a good idea to declare parameters except on Text fields. ... When I run the 2nd qry I get an error message saying that it ...
    (microsoft.public.access.queries)

Loading