locked
changing identity specification RRS feed

  • Question

  • Hi

    I have a dropdownlist that was connected in a data source but the initial value being displayed was the first record in my table. I wanted to display '--Select Category--' as my initial value in dropdown. I tried to used the AppendDataBoundItems and passed 0 value instead but I'm encountering error. This Category is a foreign key to my MainTable. There's no 0 values in my CategoryTable. I have already design the table with identity specification (Identity Seed=1 and Identity Increment = 1)and we are using it and inserted records on it. Can I still change the identity to NO just to insert 0 recordID in my CategoryTable then bring it back to YES after? Does it affect my other tables that already using this CategoryTable?

    Thank you.

    Monday, February 28, 2011 9:40 AM

Answers

  • you can insert values into identity column.

    Set identity_Insert <tableName> on

    Please check here http://msdn.microsoft.com/en-us/library/aa259221(v=sql.80).aspx

    • Proposed as answer by Pramilarani Monday, February 28, 2011 11:14 AM
    • Marked as answer by edMendoza Tuesday, March 1, 2011 12:12 AM
    Monday, February 28, 2011 10:00 AM

All replies

  • you can insert values into identity column.

    Set identity_Insert <tableName> on

    Please check here http://msdn.microsoft.com/en-us/library/aa259221(v=sql.80).aspx

    • Proposed as answer by Pramilarani Monday, February 28, 2011 11:14 AM
    • Marked as answer by edMendoza Tuesday, March 1, 2011 12:12 AM
    Monday, February 28, 2011 10:00 AM
  • great! thank you so much!
    • Proposed as answer by Pramilarani Monday, February 28, 2011 11:14 AM
    • Unproposed as answer by Pramilarani Monday, February 28, 2011 11:14 AM
    Monday, February 28, 2011 11:08 AM
  • Can you please vote as helpfull If it solve your problem.


    Thanks

     

    Monday, February 28, 2011 11:23 AM