Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Erland Sommarskog Newsgroups: comp.databases.ms-sqlserver Subject: Re: Unable to query xml data in sql server Date: Fri, 19 Jun 2020 10:24:00 +0200 Organization: Erland Sommarskog Lines: 18 Message-ID: References: <25356606-299b-4623-809d-0d6eb9af0906o@googlegroups.com> <4b1c3504-2511-4c3c-a5fb-b880e39caeb6o@googlegroups.com> <07f4ed04-6ddf-42e8-afac-655b93b690e3o@googlegroups.com> <1bed2a65-5433-4937-8341-754e4bfe4af8o@googlegroups.com> <15fe54f8-bced-4ff8-a6ba-5ead217270a5o@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Injection-Info: reader02.eternal-september.org; posting-host="d94340643b00946a32e89eabdbe10870"; logging-data="13900"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18u1XcHVe5AIwbeiehfFP98" User-Agent: Xnews/2006.08.24 Mime-proxy/2.1.c.0 (Win32) Cancel-Lock: sha1:64sdweShV0c3ly1FbI/P0Mj394w= Xref: csiph.com comp.databases.ms-sqlserver:2056 > Sorry that your knowledge is a million feet above the ground but mine is > on the other end :-( > > I think about your suggestion but still can't figure out how my cursor & > the rest of the codes work..... There are two things: 1) Iterate over the XML files and load them into a table. That is probably better done outside SQL Server using SSIS or whatever you fancy. SQL Server is not the best tool to iterate over a bunch of files in the file system. Or more directly: it is not designed for this and it is awfully akward. 2) One you have the data in the table, you do as I suggested. The same pattern appears in the StackOverflow post you referred to. Did you actually try it? Note that the data type of the column in your table should be xml - that makes things a little easier.