1
vote
1answer
288 views

Trigger to audit table changes

I have created a trigger to audit changes to a table: CREATE TRIGGER [dbo].[iudt_AutoAuditChanges] ON dbo.CPTCategoryMaster AFTER INSERT,DELETE,UPDATE AS BEGIN SET NOCOUNT ON; ...
2
votes
1answer
2k views

Converting a VARCHAR to VARBINARY

I've been keeping a log of expensive running queries, along with their query plans, in a table to allow us to monitor trends in performance and identify areas that need optimising. However, it's come ...
1
vote
1answer
146 views

Avoiding entitized characters when using FOR XML PATH for string concatenation

I have this query: SELECT DISTINCT f1.CourseEventKey, STUFF ( ( SELECT '; ' + Title FROM ( SELECT DISTINCT ...
1
vote
1answer
115 views

Move SQL Server XML column to a new table - slow performance

I have a table with a XML Column, each XML document size is 15kb and I have like 2 million rows. I need to move this XML column into a new table. I tried: insert into newtable select xmlcolumn ...
-1
votes
1answer
173 views

default value with select case on xml

select case 'NULL' when 'NULL' then 'f' end as out output: f but select case (select (SELECT LEFT(l.list,LEN(l.list)-1) FROM (SELECT o.Reciting_Path + '|' + o.Declaimer +',' AS [text()] ...
2
votes
1answer
259 views

XML queries with case insensitive tag- which is the best query

I had asked question about XML queries with case insensitive tag earlier and i found a solution too. But i also found some other solution. So table was something like DECLARE @myTable TABLE ( yourXML ...
3
votes
2answers
207 views

XML queries with case insensitive tag

I have a requirement where i want XML tags to be case insensitive in my xml queries. For example: DECLARE @myTable TABLE ( yourXML XML ) INSERT INTO @myTable SELECT ...
1
vote
1answer
314 views

Import XML data retaining while creating ID's with relationships

I need to parse XML from a file into tables while retaining their relationships through custom-generated ID values. IE, if I had the following XML: <root> <construction> ...
0
votes
0answers
114 views

XML Serialization in SQL Server 2005 CLR

I know this question has been asked before, but none of the answers I've tried seem to work for me. I'm trying to execute a CLR Stored Procedure in Sql Server 2005. The CLR generates a file, sends it ...
0
votes
2answers
652 views

Xml stored as varbinary

I'm wondering if I have to store a XML information inside a column (just storing, not for querying ) (SQL SERVER) which Datatype is better to use XML or Varbinary? I did an example: DECLARE ...
1
vote
1answer
128 views

Stored procedure to validate xml content against dtd

I have a stored procedure which creates xml content and then is stored to a xml file. Is it possible to validate the generated xml content against a dtd file? Thank you in advance!
0
votes
3answers
509 views

Indexing for query containing xml column

I have below queries which performs little slow.So i am planning to create index.I created primay xml index and now performance improved little bit(by looking at execution plan) .Queries are shown ...
6
votes
1answer
135 views

IN and NOT IN for XML column

I have a table with a xml column. Xml is similar to <Root> <Row> <user>abc</user> <Rowid>1</Rowid> </Row> <Row> ...
3
votes
1answer
398 views

Sql Server 2012 Extended Events for Selective Xml Indexing not showing results

I created a Extended Event to monitor and tune a Selective Xml Index CREATE EVENT SESSION [SelectiveXmlIndexing] ON SERVER ADD EVENT sqlserver.selective_xml_index_no_compatible_sql_type, ADD EVENT ...
0
votes
1answer
197 views

xml queries with exist and contains giving unexpected results

I have a query as shown below. DECLARE @tbl TABLE ( id INT, col XML ) INSERT INTO @tbl VALUES (1,'<Root> <Row> <User>xyz</User> ...
7
votes
1answer
648 views

Estimated vs Actual rows differences (actual much smaller than estimated) - sort

I'm running a query that is processing some nodes out of an XML document. My estimated subtree cost is in the millions and it seems it all comes from a sort operation sql server is performing on some ...
0
votes
3answers
1k views

SQL agent job step's connection managers

Is there any way with T-SQL to list the connection managers that are used in an SQL Agent Job step?
6
votes
1answer
484 views

How to shred .docx XML?

I am trying to import a xml (actually a docx file) to a sql server 2008 database. I am almost a novice in XML programming. I googled a lot but almost all the examples there are with simple xml file. ...
0
votes
1answer
122 views

Query not returning items in the original order

Consider the following set, which is the content of the table variable @ProductContent that was just created for the query that runs against it: Notice how items are sorted by media_type_id, ...
2
votes
2answers
557 views

SQL Server stored procedure working when run manually, not running from SQL Server Agent

I have a procedure that runs fine using the execute command in SSMS, however putting the same command in a job gives the following error. line 9, character 9, unexpected end of input The code ...
2
votes
1answer
152 views

FOR XML is generating a empty first line

I'm parsing with flash a XML file generated by this code: :XML ON USE MyDatabaseName GO SET NOCOUNT ON SELECT * FROM ProgramacionDia as programa order by hora FOR XML AUTO, ROOT ('toflash'), ...
4
votes
1answer
201 views

Item Index for all items in nested XML query

I have a requirement to build an XML package with a parent record, and 1..N related child records. The child records are to be a nodes under the parent node, and there may be one child record or ...
1
vote
1answer
355 views

SSMS Oracle import using OpenQuery over LinkedServer (Oracle Provider for OLEDB) - XML Parsing: unable to switch encoding

I am trying to migrate the data from an OracleDB to an SQL Server Express database. I'm doing this by openquerying a linked server (data provider based on Oracle Provider for OLEDB). Everything works ...
1
vote
3answers
336 views

SQL Server xml performance

I have a table with 21 columns. The majority are numerical and the rest are nvarchar. I need to add 4 columns that will contain XML data for each row. The XML data for each row can be anywhere from ...
17
votes
2answers
2k views

Optimising plans with XML readers

Executing the query from here to pull the deadlock events out of the default extended events session SELECT CAST ( REPLACE ( REPLACE ( XEventData.XEvent.value ...
1
vote
2answers
198 views

XML Large DataBase is the best? [closed]

Is the best way to implement a large database is XML? Or is there a better way? 1 - reduce the time complexity 2 - Reduce the amount of traffic between the tables And other factors ... Which ...
0
votes
1answer
169 views

avoid insert xml duplicate data

how can to prevent duplicate inserts for every Execute? insert into IQ (XMLDT)values('<row>sdsdf</row>')
2
votes
1answer
1k views

how to convert xml to database table

input: Declare @OUT xml select @OUT = N' <row> <kind>MainCat</kind> <sortid>1</sortid> <kind_id>1</kind_id> <PPoet>حافظ</PPoet> ...
5
votes
1answer
421 views

SQL Server / MySQL to DTD (+XML)

Is there any way I can at least export a table schema from MSSQL or MySQL to a DTD file? Also the same for the data of the tables to XML. I am really not getting how to write DTDs, so I badly need a ...
2
votes
2answers
2k views

Fast XML, slow XML

Our database update Windows application needs to transfer some data between two databases as part of the process for a certain one-time update. I chose XML as the intermediary to move the data. The ...
2
votes
1answer
117 views

I would like to better understand the SQL Server security model in terms of users and groups to possibly replace an XML heirarchy model I am using

I am currently using XML in my database to represent metadata for individual products. I am using the below schema to enter the data. In each sub grouping of fields you will notice the cms_name ...
4
votes
1answer
2k views

T-SQL: Convert XML to string without self-closing tags

We have a weirdo system we're integrating with which consumes XML, but it does not understand self-closing tags, so <BOOKING> <BOOKINGID>56812</BOOKINGID> <PERSONCODE /> ...
3
votes
1answer
908 views

How do I merge two XML variables in SQL Server (2005/2008)?

Forward: I've already read this StackOverflow thread and it does not address the depth retention I need. I want to create an XML document that contains the data definition objects for a single ...
0
votes
1answer
171 views

Parse message_body(XML)

I know the contents of @message_body are: <inserted DocNo="xxxx99999"/> I want to put 'DocNo' into a variable I created @DocNo and have tried various this such as: SET @DocNo = (SELECT ...
2
votes
0answers
257 views

going from heirarchical XML to heirarchical SQL tables then SQL to c# objects to go to user view, how should I store the data in the databases?

Hi I'm getting my data from a web service using their getData call and it comes in as fairly chunky heirarchical XML, first everything all at once, like <allData> <product1> ...
1
vote
1answer
579 views

SQL Database to XML?

I would like to export SQL data to an XML file so it can be read in COBOL. I am working with SQL Express 2008 r2.
2
votes
1answer
64 views

Would appreciate some advice on using external data with SQL Server 2005

I'm a web developer with a bit of DB experience, but this one is beyond my knowledge. We're trying to set up a new website. The data - products, prices, descriptions etc - are supplied by an external ...
2
votes
1answer
1k views

Is this a good way to store XML data in SQL SERVER 2008?

I'm doing a feasibility study for storing data in the following structure with SQL SERVER 2008: -MYTABLE |ID|RECORDS|BRANCH_OFFICE|MONTH|YEAR The RECORDS column has the XML data type and it will ...
2
votes
1answer
222 views

Where can I find information on shredding xml with .nodes?

I recently saw this answer on SO which uses the "local-name" value while shredding xml using .nodes(). I've never seen this before: select T.N.value('local-name(.)', 'varchar(128)') as Name, ...
2
votes
2answers
1k views

SQL statement to combine main table and child table as columns?

Having a main table and a child table in a Microsoft SQL Server database (2005+), I want to show the user a single table in a grid view which includes rows from the main table and rows from the child ...
6
votes
3answers
18k views

Read XML file in SQL Server 2008

How can I read an XML file and store the data in XML to our table in SQL Server 2008?