Все вопросы: [for-xml]
15 вопросов
Невозможно получить желаемый результат при создании файлов XML из запроса SQL из SQL Server
Я выполняю этот запрос select category "ROOT/category", question "Category/question", option1 "Category/option1" from testDB2 for XML PATH ('ROOT') , ELEMENTS В настоящее время в базе данных есть три записи, и я получаю следующий XML-файл <ROOT> <ROOT> <category>...
Запись XML в память вместо диска
Как мне записать результаты хранимой процедуры FOR XML PATH в память, а не в файл на диске? Текущий способ работы: private void GetChartData(string OC_Ttl1, string OC_Ttl2, string OC_OL31) { OC_Ttl_1 = OC_Ttl1; OC_Ttl_2 = OC_Ttl2; OC_OL3_1 = OC_OL31; //Output xml DataS...
Truly empty element with sql server for xml-directive
How do I create a truly empty xml element with the for xml-directive in sql server (2005)? Example: select '' for xml path('element'), root('elements') Outputs: <elements><element></element></elements> But what I really want is: <elements><element />...
Using "FOR XML" with XML Serialization with DATETIME type
I'm having issues trying to add some dates to a pre-existing class that is loaded via XML Serialisation, and it's not doing what I thought it should do. I knocked up a basic test with SQL of (where EffectiveFrom and EffectiveTo are declared as DATETIME) SELECT o.EffectiveFrom AS [@EffectiveFro...
Create XML from SQL Server 2005 data using FOR XML
I'm trying to create an Excel XML that I want to store in an XML Field in SQL Server 2005. I have gotten this far: WITH XMLNAMESPACES ( 'urn:schemas-microsoft-com:office:spreadsheet' as "s", 'urn:schemas-microsoft-com:office:office' as "o", 'urn:schemas-microsoft-com:office:excel' as "x" ...
Writing the results of a FOR XML query to a file with C#.NET
I'm trying to write the result of a FOR XML PATH query to a file. I can generate the file, but it doesn't contain the results of the query. Any one know where i'm going wrong? private static void GetChartData(string OC_Ttl1, string OC_Ttl2, string OC_OL31) { //Prepare Connection Var...
SQL Server 2005 "FOR XML PATH" Grouping
I'm trying to generate a XML document from the SQL Server 2005 database by using "FOR XML" construct. There are two simple tables in the database with a one-to-many relationship: 1) Magazines | Id | Number | Name | ---------------------------- | 53 | 0001 | Magazine 1 | | 54 | 000...
Sql Server - Capture an XML query and save it to a table?
I would like to run a (extensive) query that produces one line of XML. This XML represents about 12 tables worth of relational data. When I "delete" a row from the top level table I would like to "capture" the state of the data at that moment (in XML), save it to an archive table, then delete a...
FOR XML PATH in Sql Server
NOTE: I have solved the majority of this problem but have run into a snag. Read to the bottom please. You will see where I added a (NOTE) section. TIA. I have a rather extensive join query that I want dumped to XML. I have it almost working but I am missing a concept in here somewhere. My ...
SQL Server FOR XML adding in a tag
So I am pulling data from a SQL Server 2000 DB then converting it to XML using FOR XML AUTO. The XML I get back looks like this. <Order OrderNumber="2000004" DeliveryPickupCharge="5.9900" SalesTaxTotal="0.0000" SubTotal="0.0000" Total="5.9900"> <Customer FirstName="Anthony" Last...
.NET XmlReader с данными FOR XML
Недавно в компании мы получили базу данных MSSQL из какого-то старого проекта, которую нам нужно интегрировать в текущее решение. База данных имеет около 100–150 хранимых процедур, которые используют предложение FOR XML AUTO, поэтому запросы возвращают полный объект-граф как XML, а не строки....
MS SQL для вопроса о пути xml относительно элемента xpath
У меня есть следующий оператор TSQL: select tblName "TblName", structure "TblName/STRUCTURE", sqlRetrieve "TblName/SQLRETRIEVE", Identifier "TblName/IDENTIFIER", '2' "TblName/OBJECTTYPE" from configTable for xml path ('') который выводит: <TblName>PD...
Критика архитектуры: преобразование SQL Server FOR XML в XSLT для расширенного интерфейса HTML
Могу ли я получить конструктивный отзыв о следующей архитектуре? Краткое описание упрощенной архитектуры: Верните XML из вашего SQL Server (используя FOR XML) и передайте его прямо в преобразование XSL для создания полнофункционального веб-сайта HTML. Каковы плюсы и минусы такой сис...
TSQL: как мне выполнить самосоединение в XML, чтобы получить вложенный документ?
У меня есть такая таблица SQL Server 2005: create table Taxonomy( CategoryId integer primary key, ParentCategoryId integer references Taxonomy(CategoryId), CategoryDescription varchar(50) ) с данными, похожими на CategoryIdParentCategoryIdCategoryDescription 123nullfoo345123bar I'd li...
SQL Server 2005 для явного XML - нужна помощь в форматировании
У меня есть таблица со следующей структурой: ------------------------------ LocationID | AccountNumber ------------------------------ long-guid-here | 12345 long-guid-here | 54321 Чтобы перейти в другую хранимую процедуру, мне нужно, чтобы XML выглядел так: <root> <cl...