XMLTOCURSOR(XMLTest,'crsXMLCursor',2048)>(Removed the quotes from around your variable name.) Because you had it enclosed in quotes, the function thinks that the XML you want it to interpret consists of just the 7 characters: "XMLTest". Because it can't find the usual XML identifying info within your 7 characters, it throws the error. Same error happens if you put a filename in quotes as the first param and then forget the 512 flag.