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.
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.
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.
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.
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.
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'
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.
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()?
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...
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.
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!
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.
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?
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.
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.
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?
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.
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 ?
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 ?
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.
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.€?
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.
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);
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.
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.
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?
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.
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?
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?