Adjust Namespaces In Generated XML
May 21, 2015
I'm having trouble getting the namespaces correct in the XML that is generated by SQL. The XML consists of two parts: a header part with some context information and the payload part with the actual data. With my current SQL script, the namespace is also copied to the payload part.
Here are some DDL and DML scripts to generate two test tables and some test data:
Code:
CREATE TABLE dbo.context(
idintNOT NULLconstraint pk_dbo_context primary key,
namenvarchar(100)NOT NULL
)
INSERT INTO dbo.context(id, name) VALUES (1, 'Here comes some great context information.')
[Code] ....
This is my current FOR XML script that generates the XML:
Code:
;WITH XMLNAMESPACES (DEFAULT 'http://services.registersubscription-02_00.a.cool.url.com')
SELECT
CEXT.name AS [Context/Name],
(SELECT
CONT.id AS [Content/Reference],
[Code] ....
This generates this XML (notice that the namespace is repetated in the <Questions> element):
Code:
<RegisterSubscription xmlns="http://services.registersubscription-02_00.a.cool.url.com">
<Request>
<Context>
<Name>Here comes some great context information.</Name>
[Code] ....
The XML should be like this:
Code:
<RegisterSubscription xmlns="http://services.registersubscription-02_00.a.cool.url.com">
<Request xmlns="">
<Context>
<Name>Here comes some great context information.</Name>
[Code] ....
The generated XML does not pass the XSD validation.
View 1 Replies
ADVERTISEMENT
Apr 19, 2006
hi,
i cant seem to import Microsoft.SqlServer.Dts.Pipeline.
What i only have is Microsoft.SqlServer.Dts.Runtime.
can you tell me how to have to this?
also, how can i access ComponentMetaData object? Is this part of Dts.Pipeline?
thanks.
- ranier
View 11 Replies
View Related
Nov 19, 2007
Hi
I've been banging my head against this one for a while. There are examples around but I can't seem to find anything that works (or find an explanation).
The problem: The xml document uses an imported common schema to reference common tags/objects (xmlns:cmn) but I can't seem to get openXML working with multiple namespaces. If I remove the primary namespace (emboldened in red) the SELECT returns as expected. Editing the xml document is not an option.
Here's (a simplified version) of my code...
--------------------------------------------------------------------
DECLARE @idoc INT
DECLARE @doc varchar (8000)
SET @doc ='
<?xml version="1.0" encoding="UTF-8"?>
<LHA_DATA xmlns="http://www.trs.co.uk/schema/DataShare.xsd" xmlns:cmn="http://www.trs.co.uk/schema/Common_ed.xsd">
<Manifest>
<cmn:senderRecipient>
<cmn:LACode>A0000</cmn:LACode>
<cmn:OfficeCode>0</cmn:OfficeCode>
</cmn:senderRecipient>
</Manifest>
</LHA_DATA>
'
EXEC sp_xml_preparedocument @idoc OUTPUT, @doc, '<LHA_DATA xmlns:cmn="xmlns="http://www.trs.co.uk/schema/DataShare.xsd" http://www.trs.co.uk/schema/Common_ed.xsd" />'
SELECT *
FROM OPENXML (@idoc, 'LHA_DATA', 2)
WITH (LACode varchar(10) '//cmn:LACode',
OfficeCode varchar(10) '//cmn:OfficeCode')
EXEC sp_xml_removedocument @idoc
------------------------------------------------------------------------
Any help greatly received!!!!
View 1 Replies
View Related
Jun 20, 2007
Hi eveyone, I'm reading about namespaces and schemas in MS SQL 2005, and that's exactly what I was looking for for the structure of my database.
I've a database and 4 different applications that will use it, and every application will create a new database every year, for example, i'd like to use the following schema:
MainDatabase.MyApplication.MyYear.MyTable
In MS SQL i've created my main schema using:
USE Mydatabase;
CREATE SCHEMA MyApplication
GO
Now I want to add sub-groups (in this example, I need to create Year2006, Year2007, and so on).
Even If i create those schemas, how can I "add" them inside the Salary main schema?
I've tryed with
ALTER SCHEMA MyApplication TRANSFER Year2006
but it doesn't work since Year2006 is not an object.
Thank you!
View 6 Replies
View Related
Feb 28, 2006
I'm trying use the SSIS XML Task to process some XML files that have namespaces and schemas defined . One of the things I am doing is trying to perform an XPATH query on the files. However, I'm unable to provide either a namespace manager or XsltContext to the XML Task and that causes the XML Task to not understand my XPATH queries.
For example, if my XML is:
<o:object id="12345" xmlns:o="urn:some-urn"/>
and my desired XPATH is "/o:object/@id", I get the following error:
Error: 0xC002F304 at Query, XML Task: An error occurred with the following error message: "Namespace Manager or XsltContext needed. This query has a prefix, variable, or user-defined function.".
Of course, the XPATH "/object/@id" returns nothing as expected.
Is there a way around this?
View 3 Replies
View Related
Feb 15, 2012
I am trying to select data from a column that has xml data in it. I have tried all I can think of, but the results keep coming back as NULL. Not sure why but I pasted the top of the xml document so show what I am trying to do.
- <ns0:X12_00501_837_P xmlns:ns0="http://schemas.microsoft.com/BizTalk/EDI/X12/2006">
- <ST>
<ST01_TransactionSetIdentifierCode>837</ST01_TransactionSetIdentifierCode>
<ST02_TransactionSetControlNumber>1001</ST02_TransactionSetControlNumber>
<ST03_ImplementationGuideVersionName>005010X222A1</ST03_ImplementationGuideVersionName>
</ST>
And the query...
WITH XMLNAMESPACES('[ns0]' AS ns)
SELECT sourceclaimxml.value('(/ST01_TransactionSetIdentifierCode)[2]', 'varchar(300)') XMLValue
FROM xclaim_audit_xml
CROSS APPLY sourceclaimxml.nodes('//ST') as P(nref)
WHERE edixid='2323111'
View 9 Replies
View Related
Jun 19, 2008
I have an XML document that I am trying to use within a data flow (XML Source)--the problem is that I keep getting an error message stating that the XML document has multiple namespaces and therefore, SSIS will not create the XSD for me. If I take out the second namespace, I am able to successfully get the task to execute, but this XML is created with 2 namespaces and there is no way to get around this (I cannot get the report server to change these parameters)--my question is: know a way to get SSIS to handle multiple namespaces so that I can process this XML document and extract the necessary data elements from it.
View 11 Replies
View Related
May 23, 2008
Hello
I tried the Beta 1 of the service pack 1 to .net 3.5. If I try to add an entity (and try to save this), I get the Exception "No support for server-generated keys and server-generated values".
How can I add entities to my Sqlce- database?
I tried to give the id- column (primary key) in the database an identity, another time without identity, only primary key --> none of them worked. I always get the same error.
What do I have to change to make successfully a SaveChanges()?
Thanks for your help,
Gerald
View 21 Replies
View Related
Oct 3, 2007
Does anyone know how or where to adjust Ram Memory usage for SQL 2000.
I've just added Changed the 512 MB Ram that came with the Server and Exchanged it with 4 GIG Ram . Is it a good Idea to allow only 2GiG for SQL . I 've heard that SQL will take/use all Ram that you install if you let. If this is true
Can anyone advise on how/where to make adjustments. Thank You...
View 2 Replies
View Related
Apr 6, 2008
Hi,
I have a table with an identity column..How will the identity gaps be adjusted if i delete few records in the table..ie..the sequence should automatically adjusted..Is there any way for this ?
ID Name City
1 abc xyz
2 mexm mcel
3 olekc kcome
Suppose i delete the record where ID=2..still the sequence should be auto adjusted..ie.the record of ID=3 should become ID=2 automatically..there shouldn't be any gaps.
View 8 Replies
View Related
Apr 3, 2006
Hi everyone,Here is the problem I am facing with. I have a form which has multiple fields including Price (read only), Discount(read/write), TotalSellPrice(read/write), Quantity(read/write) ... What I need to do is I need to adjust TotalSellPrice value if there was a new Discount value entered and vise versa. If both values have been changed I should use Discount value entered and calculate the TotalSellPrice. I am having hard time figuring the query out. Any thoughts or ideas in what direction should I go.Thanks for your help!
View 8 Replies
View Related
Nov 5, 2015
I have designed a matrix report to display activities for which I added a table with in one of the cell When I run the report, I see activities but the row alignment is not proper and also when there are no records it displays blank.
View 6 Replies
View Related
Apr 23, 2015
One server, a part of a 2 node always on cluster, had problems, I had to restart.
I'm getting this error for example now:
Error: 49910, Severity: 10, State: 1. (Params:). The error is printed in terse mode because there was error during formatting. Tracing, ETW, notifications etc are skipped.
+
SQL Server was unable to run a new system task, either because there is insufficient memory or the number of configured sessions exceeds the maximum allowed in the server. Verify that the server has adequate memory. Use sp_configure with option 'user connections' to check the maximum number of user connections allowed. Use sys.dm_exec_sessions to check the current number of sessions, including user processes.
Now, on the instance I have activated maximum servere memory, my question; Is it possible to adjust this setting without starting the service?
Some parameter for example?
The server itself have enough memory.
View 3 Replies
View Related
May 7, 2008
My default filter settings are: Name Schema Created
How do I add an additional filter such as 'Modified'?
I can get into the Filter Dialog box by clicking on the Funnel, but I can't figure out how to add another filter to the list.
-smc
View 3 Replies
View Related
Nov 11, 2015
I developed a SSRS report, the problem is i dont have data in DEV server. So i dont know how to adjust the column lengths in ssrs report. is there any property so that the column length can be adjusted dynamically based on the data length whenever data is available in production.
View 3 Replies
View Related
Mar 4, 2004
Our database creates proposals, work orders, and purchase orders. Each of those systems pulls from the same price list. I need to be able to adjust pricing for products without affecting the proposals, work orders, and purchase orders. Does anybody know how to steer me in this direction?
Email: jason73178@hotmail.com
View 12 Replies
View Related
Mar 15, 2006
I have an old application running on SQL Server 6.5 (6.50.416) that has a number of internal issues - inability to dump the transaction logs (would dump 9gb out of a 10gb datbase everytime regardless of truncating the logs), transaction log size of 0 even though 700mb allocated, very long DBCC's (though they complete properly).
I am trying to salvage the database by using DTS to copy out the schema, data, sp's, etc. into a new database.
I have the conversion running without error. Data usage goes from almost 10gb down to under 3gb and the transaction logs are now working.
However, when I use DBCC checkdb on the new database, I get the following (just a small sample):
Checking 524528902
Msg 2506, Level 16, State 3
Table Corrupt: The values in adjust table should be in ascending order starting from the end of the table (page#=25930 row#=10); check adjust table in this row
Msg 2524, Level 16, State 1
Table Corrupt: Row length is inconsistent between the computed row length and the recorded row length on page; check the following page and row: pageno=25930 row#=10 computed row length=551 row length on page=550
Msg 2506, Level 16, State 3
Table Corrupt: The values in adjust table should be in ascending order starting from the end of the table (page#=25941 row#=2); check adjust table in this row
Msg 2524, Level 16, State 1
Table Corrupt: Row length is inconsistent between the computed row length and the recorded row length on page; check the following page and row: pageno=25941 row#=2 computed row length=527 row length on page=526
Msg 2596, Level 16, State 1
Page pointer = 0x1b20a800, pageno = 25941, status = 0xD, objectid = 524528902, indexid = 0 has an incorrect pgfreeoff value of 1794. The offset should be 1384.
Msg 2506, Level 16, State 3
Table Corrupt: The values in adjust table should be in ascending order starting from the end of the table (page#=25967 row#=2); check adjust table in this row
Msg 2524, Level 16, State 1
Table Corrupt: Row length is inconsistent between the computed row length and the recorded row length on page; check the following page and row: pageno=25967 row#=2 computed row length=527 row length on page=526
Msg 2596, Level 16, State 1
Page pointer = 0x22ab9000, pageno = 25967, status = 0x5, objectid = 524528902, indexid = 0 has an incorrect pgfreeoff value of 1667. The offset should be 1345.
Msg 2506, Level 16, State 3
Table Corrupt: The values in adjust table should be in ascending order starting from the end of the table (page#=26146 row#=0); check adjust table in this row
Msg 2524, Level 16, State 1
Table Corrupt: Row length is inconsistent between the computed row length and the recorded row length on page; check the following page and row: pageno=26146 row#=0 computed row length=551 row length on page=550
Msg 2506, Level 16, State 3
Table Corrupt: The values in adjust table should be in ascending order starting from the end of the table (page#=26151 row#=5); check adjust table in this row
Msg 2524, Level 16, State 1
Table Corrupt: Row length is inconsistent between the computed row length and the recorded row length on page; check the following page and row: pageno=26151 row#=5 computed row length=521 row length on page=520
Msg 2506, Level 16, State 3
Table Corrupt: The values in adjust table should be in ascending order starting from the end of the table (page#=26163 row#=0); check adjust table in this row
Msg 2524, Level 16, State 1
Table Corrupt: Row length is inconsistent between the computed row length and the recorded row length on page; check the following page and row: pageno=26163 row#=0 computed row length=546 row length on page=545
Msg 2596, Level 16, State 1
Page pointer = 0x218ba800, pageno = 26163, status = 0x5, objectid = 524528902, indexid = 0 has an incorrect pgfreeoff value of 1387. The offset should be 577.
etc...
The errors occur only on 3 specific user tables, and are consistent each time I try the conversion. Same exact page numbers and offsets (page pointers are of course different). I do not get any DBCC errors on the original DB at all. I can do select's on the tables without issue, and they seem to have the correct amount of data (did row counts and sums of various columns)
Any insight into what might be causing this or what the actual error is would be welcome.
Thanks,
Brett
View 7 Replies
View Related
Jun 21, 2006
Where is the sql generated by aspnet_regsql.exe saved?
View 2 Replies
View Related
Oct 1, 2004
Hi,
How can I retrieve generated identity value after insert a row into table in case I can identify inserted row?
(the INSERT statement is dynamic constructed and queried from data access layer, not in stored procedure)
Thanks,
View 3 Replies
View Related
Oct 3, 2004
Hi,
How can I retrieve generated identity value after insert a row into table in case I can identify inserted row?
(the INSERT statement is dynamic constructed and queried from data access layer, not in stored procedure)
Thanks,
View 1 Replies
View Related
Feb 7, 2007
Hello,
I've a problem with auto-generated key. In my parent table, some lines have been deleted. I would like to add new lines with the same content in order to restore my database, but I cannot decide on the id value which is an auto-generated key. Is there a solution to set an auto-generated key with a specific value ?
Thank you in advance,
regards,
mathmax
View 3 Replies
View Related
Sep 27, 2007
Suppose I want to generate a table as below
No. Col1 Col2
1 100 Alan
2 110 Alan
3 120 Alan
In Column I there is a sequence of numbers from 1 to 3 with a step of 1
In Column 2 there is a sequence of numbers from 100 to 120 with a step of 2
In Column 3 there is a name that is repeated accross the whole column
Can I generate such a table with just a single SQL Statement . I don't see any reason why it should not be possible. We know the logic to generate all the numbers of every row. It would be possible using a while loop , but that is be tedious and I am looking for a better way.
One application I can think of is, Suppose I want to find out all deleted primary key ids from a table or say if I have a set
(1,2,3, 7,8,9) , and wish to know the missing numbers in the range 1 to 9. If an sql like above is possible I could use it in a left join to get me the desired output.
Could anyone tell me if it is possible and if not , why not ?
Thanks,
Alec
View 6 Replies
View Related
May 2, 2008
Hi,
Is there any way to look at behind-the-scene SQL query that gets generated by SSRS engine to pull the data out of the data source (particularly SQL Server).
So far, I only know that you can see the query generated by semantic query engine by changing trace option in configuration file.
Thanks and Regards,
XL
View 2 Replies
View Related
Aug 28, 2007
Hi
I have a windows application. I am using following code right after setting the LocalReport ReportPath. Report rendering is too slow if use following line of code and Report viewer does not show spiny and the text that says €śReport is being generated.€?
Me.ReportViewer1.SetDisplayMode(DisplayMode.PrintLayout)
Me.ReportViewer1.ZoomMode = ZoomMode.Percent
Me.ReportViewer1.ZoomPercent = 80
Please advise how can make it fast and show spiny.
Thanks in advance.
View 8 Replies
View Related
Aug 17, 2006
I have created a report and deployed it successfully to a seperate machine with SSRS on. Both my dev machine and the SSRS machine are in the same workgroup. I can then Browse to the Report Manager though IE and click & run the report (The connection is using integrated security). The report requires a single parameter to be entered which once done works successfully. The report has a single table, an inbedded image and a few static fields in the report header.
If I however add a report viewer control to an aspx test form all is not well. As soon as the page opens I am prompted to enter the parameter which is good news as it shows there has been some communication with the SSRS metabase. I then click the view report button. Using Profiler I have proved that the report Stored Proc. is running with the correct parameter value. The report viewer however seems to hang and only displays "Report is being generated" without displaying the results. It does this even with a timeout set of 1000ms.
I don't think this is a security issue as both the Report Manager works and the test form prompts me for the parameter and effectively runs the report SP. I can only assume it is a problem with returning the report to the browser.
Does anyone have any insight?
Regards
Anthony Kay
View 3 Replies
View Related
Apr 13, 2006
Hi,
I created a PDA application with a database, which has a table with a uniqueidentifier field and primarykey.
While doing the bulk insert from dataset into sql mobile database, It is inserting the record but it is not inserting the id which was entered into the sql server 2005 database, instead the id by creating a new id and the code is as below.
conAdap = new SqlCeDataAdapter(strQuery, conSqlceConnection);
SqlCeCommandBuilder cmdBuilder = new SqlCeCommandBuilder(conAdap);
conAdap.Fill(dsData);
int r =conAdap.Update(dsData);
Please help me.
Thank you,
Prashant
View 1 Replies
View Related
Jan 16, 2008
Hi,
I have a report which doesn't work. It has a datatset based on a store procedure. The store-procedure take 10 to 50 second to execute, depending on the parameters.
But, I can't never see my report as i wait more than 10 minutes and it's never generated.
So, I have think that maybe it could be because of the matrix inside the report, so I have try to create another report which have the same dataset but with nothing inside, just a textbox, and it doesn't work too !!
So now, i'm very disapointed and I don't know what to do !
Someone can help me please ? It's very important.
Thank you.
View 2 Replies
View Related
Aug 2, 2006
I created a new DataSet object using the
wizard and had no probs, it's very straightforward. I created a
GetProducts() method and also added a GetProductCount() method. I
read somewhere that when the DataSet is saved, it will generate the
TableAdapter classes and store them in the project nested under the
DataSet object. This isn't happening, the files aren't there and
yes I'm displaying all files. There *is* however the TableAdapter
class but it's in not in the project, it's a temporary file w/ the
following path:
C:WINDOWSMicrosoft.NETFrameworkv2.0.50727Temporary ASP.NET
Fileswebsitef38f8b5500014aeSources_App_Codepw_products.xsd.72cecc2a.cs.
I saved the DataSet several times, compiled the entire solution and
even closed the solution yet this temporary file isn't getting saved
where it should be. Does anyone have any ideas abt this?
I'm eager to start developing my DAL and def want to use these
TableAdapter classes.
Thx in advance,
-Pete
View 2 Replies
View Related
Oct 24, 2006
Can someone explain the generated sprocs of VS2005 if one column can be nullableDependentOfSeqID = @Original_DependentOfSeqID OR ((@IsNull_DependentOfSeqID = 1) AND (DependentOfSeqID IS NULL))In VS2003 the generated sprocs would beDependentOfSeqID = @Original_DependentOfSeqID OR ((@Original_DependentOfSeqID IS NULL) AND (DependentOfSeqID IS NULL))Which is the best?
View 1 Replies
View Related
Nov 11, 2006
HI all,
if this issue has been solved, please provide me the post, or I've put this issue in a wrong category please let me know.
The following is my code:
DateTime dtBFWNow = DateTime.Today;
String dtBFW_range1 = dtBFWNow.AddDays(-7).ToShortDateString();
String dtBFW_range2 = dtBFWNow.AddDays(3).ToShortDateString();
SqlDataSource1.SelectCommand = "SELECT * FROM [MORTGAGE] WHERE ([BringForwardDate] is not null) and ([BringForwardDate]>= '" + dtBFW_range1 + "' and [BringForwardDate] <= '" + dtBFW_range2 + "')";
lblHeader.Text = "Bring Forward Reminders Due From '" + dtBFW_range1 + "' To '" + dtBFW_range2 + "'";
lblHeader.ForeColor = System.Drawing.Color.FromName("#000000");
GridView1.DataBind();
When I compiled, the following exception occurred:
The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
and the exception points right at the line: GridView1.DataBind()
I use the webhost4life as my server provider. My codes run fine with the server. I mean I uploaded my program to the server, set up and run the program online, everything is fine.
But on my PC it gives me the above exception. I can't compile my code. There must be some sort of setting somewhere in my PC that can't handle the exception.
Please help.
Regards.
Joey.
View 2 Replies
View Related
Jun 21, 2001
I ran a SP that lists fragmented tables in our DB which listed almost all the tables and indexes in the DB. The list includes index names that start with "_WA_Sys_tablecolumn name_.....". Are these SQL Server generated indexes or are these statitics on the tables? What are they? If these are system generated indexes as I thought they were, how are they generated? Can these indexes be dropped or should one want to? IF so, how? Any effect on the DB performance if dropped?
Thanks for your advise.
Helen
View 2 Replies
View Related
Aug 22, 2001
Hello,
We're trying to do the following...
Declare @Name Varchar(15)
Select @Name = 'TableName'
Select @Name = @Name + Rand(SomeSeedValue)
Select *
Into @Name
From Someothertable
This just gives us syntax errors, anyone else had any success with this ?
View 1 Replies
View Related
Oct 18, 1999
I am using Enterprise Manager to generate a script of the stored procedures on my database. Under File|Options, I selected Windows Text(ANSI). The file which is generated contains all stored procedures, but there are some procedures which are so long that they wrap to the next line.
When I then try to run this script from ISQL in a batch file, those procedures which wrap error out. Is there any way to generate the script in a more formatted manor, avoiding the wrapping?
View 1 Replies
View Related