Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Help with OPENXML

Author  Topic 

nomedia
Starting Member

3 Posts

Posted - 2003-10-22 : 04:04:36
Hello,

I need some help here with OPENXML.

I get an error, when executing this query:


SELECT * FROM OPENXML (@idoc, '/formulier', 2) WITH (datumVeld varchar(7900) 'datumVeld')

@idoc is declared and has the integer-value of the XML-document executing.

When I return the executed statement (with @idoc filled in with it's value) the statement is:


SELECT * FROM OPENXML (41, '/formulier', 2) WITH (datumVeld varchar(7900) 'datumVeld')

So @idoc has the value 41.

The error in here is:


Line 1: Incorrect syntax near '41'.

Anyone have any idea what the error is?

I think the error has something to deal with the fact that I'm trying to make the script dynamically ('datumVeld' is the value of a variable).

I have compared the statement with a working example, but see no real difference.

A working example:


SELECT * FROM OPENXML (@idoc, '/formulier', 2) WITH (Titel varchar(8000) 'titel')

I hope anyone can help me with this error...

robvolk
Most Valuable Yak

15732 Posts

Posted - 2003-10-22 : 08:23:13
You must pass the variable, not the value of the variable.
Go to Top of Page
   

- Advertisement -