.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Foreign characters causing a duplicate attribute key error - how to avoid?

Posted By:      Posted Date: September 10, 2010    Points: 0   Category :Sql Server
Greetings, We have a data warehouse into which we import data obtained from our outside vendors.  The data are then used to build data cubes.  Lately we have started to get a duplicate key error on the "County" attribute in our "Location" dimension.  The problem appears to be caused by these two values returned by the query that returns the distinct list of counties: Spree-Neisse Spree-Neiße These are German counties and they are really the same county, I believe.  Our data warehouse stores County as a varchar.  If I cast the stored value as nvarchar, the query that returns the distinct list of counties returns only the 2nd value and so should avoid the duplicate key error.  (I haven't tried it yet, just speculating.) This post suggests the root cause of the problem: http://ssas-musings.blogspot.com/2009/11/duplicate-key-error.html We don't have any control over the data before our vendors give it to us, and it comes from all over the world.  What is the best way to avoid occurrences of the duplicate attribute key error?  Should we be storing all our character data as nvarchar?  Would it be enough to cast the stored data as nvarchar when the cubes are being built?  Is there a better approach?  I'd like to get an idea of what the best practice would be.  Our warehouse

View Complete Post

More Related Resource Links

SharePoint Calendar Error: The "ListViewWebPart" Web Part appears to be causing a problem. Index was

In one specific SharePoint calendar, on one specific week in that calendar when we select the "more items" link in the monthly view (or the expand all option) we get the following error:
The "ListViewWebPart" Web Part appears to be causing a problem. Index was outside the bounds of the array.

Web Parts Maintenance Page: If you have permission, you can use this page to temporarily close Web Parts or remove personal settings. For more information, contact your site administrator.
Troubleshoot issues with Windows SharePoint Services.

If we select a different week the expand and collapse works fine in that calendar.

causing 500 server error :(


So, I'm just learning ASP.NET with C#, but this code just makes the page display a "500 - server error page"

the webpage is here: hereswhereyourewrong.net/aspnettest.aspx

the code is as follows:

<%@ Page Language="C#" AutoEventWireup="true" %>
<!-- This program throws up an Error 500: Server Error -->
<!-- I'm not sure why, it compiles just fine. -->
<!-- The last time it was because I had asp:TextBox fields not in a form -->
<!-- but here I just don't know -->
    <head runat="server" >
        <title>ASP.NET With C# Test</title>
        <script runat="server">
            protected void Page_Load(object sender, EventArgs e)
                timeText.Text = DateTime.Now.ToString("MM-dd-yyyy HH:mm:ss");

            public void updateTime(object sender, EventArgs e)
                timeText.Text = DateTime.Now.ToString("MM-dd-yyyy HH:mm:ss");
        <div style="text-align: center;">
            <form runat="server" ID="timerForm">
                <asp:ScriptManager ID=

'Unspecified error' doing sp_xml_preparedocument on XML element with a long attribute

In SQL Management Studio 2008 (connected to SQL 2005 database), I get this:The XML parse error 0x80004005 occurred on line number 2, near the XML text "<item value="&#xD;&#xA;libname...Msg 6602, Level 16, State 2, Procedure sp_xml_preparedocument, Line 1The error description is 'Unspecified error'.When I do this declare @doc nvarchar(max), @idoc int set @doc = '<item value="&#xD;&#xA;libname..." />' EXEC sp_xml_preparedocument @idoc OUTPUT, @doc when the value of the @value attribute is actually a string of somewhat over 830000 characters.If I truncate the string somewhat, the statements execute successfully.Anyone know how to fix this?  (and "use shorter attributes" is not an acceptable answer :-)I would use XQuery except that I can't figure out how to get the equivalent of @mp:id and @mpparentid to give me the hierarchical structure information I need.  If anyone knows how to do that, I'd appreciate a hand there too!  

Getting the exact page causing an error using Server.GetLastError

Using vb.net/asp.net 2005.in the global.asax page in the application error page I am getting the exception information as follows: Dim CurrentException As Exception = Server.GetLastError() Dim ErrorDetails As String = CurrentException.Message.ToString & "<br><br>" & CurrentException.ToString() To find out when there are any exceptions when users are using the system, then the ErrorDetails are being auto-emailed to members on the IT team to help in troubleshooting.The problem is this:  I want to find out what page is the user is on when the exception happens, sometimes the stacktrace does not list the aspx page.  Does anyone know how to get this information?thanksMC

Duplicate columns names not allowed - OPENQUERY - OPENROWSET - Error 492

I have a piece of code below which manipulates incoming XML. I understand why it is failing in SQL2005, due to the duplicate name "Process". What i dont understand is why this works fine in SQL2000? We are trying to migrate from SQL2000 to SQL2005 and even if we run SQL2005 in 8.0 compatibility mode we still get the error. Why does it work in SQL2000 and is there anyway to emulate this behaviour in SQL2005? I really do not want to work through +-600 SPs to see if I need to change anything. Thank You declare @Event varchar(255) declare @XML varchar(3000) set @event = '' set @xml = '<OmegaEvent Process="NEWBUSINESS" Type="APPFORM" DateTimeStamp="2010-09-02T06:06:43" Version="3.0"> <APPFORM> <BUSSUNIT>AN</BUSSUNIT> <CATEGORYDESC> </CATEGORYDESC> <CHECKDIGIT>B</CHECKDIGIT> <CLIENTSTATUS> </CLIENTSTATUS> <CONVERSION> </CONVERSION> <DISTRCHANNEL> </DISTRCHANNEL> <EVENTDATE>20100902</EVENTDATE> <EVENTTIME>60643528960</EVENTTIME> <FINALISOR>N</FINALISOR> <FORM>MIFU</FORM> <FORMNAME>MAX INCOME COMPULSORY</FORMNAME> <INTERMEDCODE> </INTERMEDCODE> <MAIL_CAMPAIGN> </MAIL_CAMPAIGN> <POLICYNO>016058558</POLICYNO> <PROCESS>ICC</PROCESS> <PR

Duplicate column error in script

Hello, I have a new database server and I created a new database and now I'm trying to run a script that's supposed to create all the tables from the previous database server. The script is an accumulation of various changes I have made to the old database since the start of the project in order to implement a variety of features, so it has this pattern: ALTER TABLE X DROP COLUMN Y; GO and later in the file: ALTER TABLE X ADD Y int NOT NULL; GO When I run the script, I get a duplicate column error message for the table and field, although I first dropped the column and then added it again. I suppose I have to do some kind of flash after the drop and before the add, but isn't the GO supposed to do that? If not, how can I flash it in the script? Thanks.  

'inherits' attribute, error

Hey guys. I'm getting this error. Source Error:  Line 1:  PartialClass secure_home Inherits System.Web.UI.Page Line 2:  Protected Sub GridViewZ_RowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs) Line 3:      If e.CommandName = "Add" ThenSource Error:Compiler Error Message: ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl). Line 1:  PartialClass secure_home Inherits System.Web.UI.PageLine 2:  Protected Sub GridViewZ_RowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs)Line 3:      If e.CommandName = "Add" ThenMy CodeFile has this at the top:PartialClass secure_home Inherits System.Web.UI.PageProtected Sub GridViewZ_RowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs)My aspx file has this at the top:<%@ Page Language="VB" AutoEventWireup="false"  Codefile="a_Order_Details.aspx.vb" Inherits="secure_home"%>Any idea how to solve this? 

Master Detail-Modal Popup Duplicate Component ID error

This is my main page in which I have collapsible panel and my phone gridview is contained in it. The Initial page loads up properly and shows the gridview. All the errors happen when I select a gridview row for modal popup edit. I get the following errors one after other after ignoring each one of them. I have been struggling with his for almost a week. I would appreciate if someone could help me get rid of these errors. Following are the sections of the main page and the code in the gridview ascx control . Main GridView User Control Page.<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/basemaster.master" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> <%@ Register TagPrefix="ucophone" TagName="ucopsphone" Src="~/UserControls/online_app_phone_gv.ascx" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <div> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:CollapsiblePanelExtender ID="CollapsiblePanelExtenderPhone" runat="server" TargetControlID="PanelContentPhone" Supp

A duplicate attribute key has been found when processing

Hi When I process one of my dimensions it fails and I get the following error: Errors in the OLAP storage engine: A duplicate attribute key has been found when processing: Table: 'Customers', Column: 'DisplayName', Value: 'Stephen Grant'. The attribute is 'Display Name'. I don't know if this is significant, but the attribute to which it is making reference was added through BIDS 2008 (the cube was originally created with BIDS 2005).  There are no duplicates of 'Stephen Grant' in the DisplayName column. Not that it should matter if there were as this attribute has a cardinality of Many, with an rigid attribute relationship directly to the dimension's key attribute. The Key column for the Display Name attribute simply refers back to the same (DisplayName) column in the table. If I delete this record, or even just update the DisplayName field from 'Stephen Grant' to something else, the dimension processes just fine. I can't work out what it is about this record that is stopping the dimension from being able to process. Can anyone help me figure out what's going on? Julia. P.S. I am using SSAS 2008 on Windows Server 2008

Duplicate field name error, creating new site from custom template

I've made a site that maps the site (with a table of contents) and i export it to another site collection. I'm able to install and activate the solution in the other site collection, however when i'm going to create a new site using the site i've installed as a template it pops an error saying "A duplicate field name Wiki_x0020_Page_x0020_CategoriesTaxHTField" was found." I have no clue what this means. Can anyone help me? Thanks in advance

How can I avoid error a Insert Store proc if he don't find any coloum in a table


I have created one Insert Proc for a table which has three Colourm. 

Id int, [Name] varchar (30), Phone varchar (15) I want to use this proc for another Table which has two coloum which is semiler with first table lie   Id int, [Name] varchar (30) I want to use one Insert Store Proc For two Table. I can avoid null value of parameter but but can't avoid if the coloum is not exist. 



cube deployment fails- A duplicate attribute key has been found when processing

I am trying to create a cube using the same process that I always do. however this time I get an error message "Warning 4 Errors in the OLAP storage engine: A duplicate attribute key has been found when processing: Table: 'dbo_ALL_ResultsNewest', Column: 'MktCapGroup', Value: ''. The attribute is 'Mkt Cap Group'.  0 0 
This is using alot of data but I have created similar size cubes before. I create simple cubes with a single dimension and all the attributes related to a single master attribute. I am a data analyst, not a technologist and don;t have any real understanding of cube internals beyond the basics.

Identity Insert Error & Conflict with Foreign Key


So I'm trying learn SQL using the CBT Nuggets and am at a point where they must have made a mistake because I've gone through and followed everything to a fine detail and they must have left something out.

So I am trying to insert a row into a table and get following IDENTITY_INSERT error:


So I do some research and find out how to turn on the INDENTITY_INSERT as well as identify the column list. After doing so I get a foreign key error as before attempting to enter the row I created a relationship between the 'country' column and the 'country_code' column from the countries.dbo table. (see below for code).


Foreign Key Error

The error it fully states is:

(0 row(s) affected)
Msg 547, Level 16, State 0, Line 3
The INSERT statement conflicted with the FOREIGN KEY constrai

Best way to avoid error message due to null vs integer incompatibility


I receive the error message below, I think because the database field in question is null (I realize I probably should not allow null values, but I can't even display the page to allow the user to enter a value---and I would prefer not to enter a default value in SQL).

How do I avoid this error message? If the column is null (and it is supposed to be an integer), do I need to change the value to something like "0" in the code behind---or is there any easier way to do this right in aspx page (see source of error message below)?  Either way, I'm not sure how to do either (I can't get any such lines of code to work here). Thank you.


Object cannot be cast from DBNull to other types.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidCastException: Object cannot be cast from DBNull to other types.

Source Error:

Line 50:  <td><ItemTemplate>
Line 51:    <asp:Label ID="PriceLabel" run

Why do I get a duplicate key error on the following?

        var querymax = (from obj in EMAL_db.tObjects
                select (int?)obj.Id).Max();
        if (querymax != null)
          nextObjectId = (int)querymax + 1;
        newObject = new tObject();
        newObject.Id = nextObjectId++;
        catch (Exception ex0)
          MessageBox.Show("Exception in Converter.Execute " + ex0.Message + Environment.NewLine + ex0.StackTrace);

After unsuccessful attempts to insert into the database, ID's are consumed so that next to be inserted can be i.e. 143 when ...Max() returns 119. Why is that?

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend