Column Sharing and Stored Procedures

Thread is closed for posting
3 posts, 0 answers
  1. Pål
    Pål avatar
    53 posts
    Member since:
    Sep 2012

    Posted 04 Mar 2009 Link to this post


    I have three PC classes using flat inheritance strategy (shared table):

    public class Principal {
        public string Name {get; set;}

    public class BuiltinAccount : Principal {
        public AccountType BuiltinType {get; set;}

    public class BuiltinRole : Principal {
        public RoleType BuiltinType {get; set;}

    The two derived classes share the column "BuiltinType" for their properties "BuiltinAccount" and "BuiltinRole" which works fine, until I try to use stored procedures.

    When building database, I get the following exception when creating stored procedure for the base class:

    The variable name '@BuiltinType' has already been declared. Variable names must be unique within a query batch or stored procedure.

    I guess this has to do with the fact that all columns in the table will be initialized either with a value or null, and since two derived classes reports the need of @BuiltinType column, they will be added twice.

    Is this something you can fix, e.g. by performing a check if column already exists, and if so not add it again. It does work fine when not using stored procedures.

    Best regards

  2. Pål
    Pål avatar
    53 posts
    Member since:
    Sep 2012

    Posted 05 Mar 2009 Link to this post

    Hi again. Have created a test project with the forementioned classes which replicates the problem.

    If you send me an email-address to mine, i'll ship the solution to you.


  3. Jan Blessenohl
    Jan Blessenohl avatar
    707 posts

    Posted 06 Mar 2009 Link to this post

    Hi Pål,
    That sounds good, thanks.

    Please open a support ticket and attach the example as zip file there.

    Jan Blessenohl
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top