Unanswered Check Constrain in Data Generation Plan in Two Columns

  • Tuesday, March 27, 2012 1:25 PM
     
     

    I have a Table with two columns say Col1 & Col2. Col1 is type is int and Col2 type is long. I have a check constrain : any one of the column must have a valid value and the other column should be null. That is both columns cannot be null in a row. Both cannot be filled up with valid value in a row. Both columns are foreign key.

    How can i accomplish that. I have wrote custom data generator. But i was unable to use nullable int as Output of generator.


    • Edited by Jahirhstu Tuesday, March 27, 2012 1:41 PM
    •  

All Replies

  • Thursday, March 29, 2012 6:58 AM
    Moderator
     
     

    Hello Jahirhstu,

    I am trying to involve someone familiar with this topic to further look at this issue.

    Thanks.


    Vicky Song [MSFT]
    MSDN Community Support | Feedback to us

  • Thursday, March 29, 2012 3:47 PM
     
     

    Hi,

    Can you post a sample of your code and more details of the error(s), if any?

    Thanks!

    Cathy Miller

  • Friday, March 30, 2012 5:54 AM
     
      Has Code
    Following shows my custom data generator code. It works fine and shows in Generator Column's Dropdownlist in data generation plan when i make ID property and _id field as int. But i required nullable int as output. So when i am converting _id field and ID property as nullable int then it doesn't show in Generator Column's Dropdownlist in data generation plan. How can i resolve that.
    [Output(Description = "", Name = "ID")]
            public int? ID
            {
                get
                {
                    return _id;
                }
            }
    
            protected override void OnGenerateNextValues()
            {
                if (_rowNo % 2 == 0)
                {
                    this._id = GetRandomDigit();
                }
                else
                {
                    this._id = null;//_id is nullable int
                }
    
                _rowNo++;
            }


    jahirhstu


    • Edited by Jahirhstu Saturday, March 31, 2012 1:06 AM More Descriptive
    •  
  • Saturday, March 31, 2012 4:23 PM
     
     
    Can Anyone help me about my issues. I am getting late. Please help.

    jahirhstu

  • Thursday, April 12, 2012 2:36 PM
     
     

    Hi,

    Perhaps you would get a better response with a more in-depth level of support.  Please visit the below link to see the various paid support options that are available to better meet your needs. http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone

    Thanks,

    Cathy Miller