none
SDF table ID not resetting to one RRS feed

  • Question

  • I've got a Sales table which has a Primary Key  which is also Identity(1,1) called SaleID.  Whenever I copy the blank "fresh" database over to the device to replace an existing one, after the first Sale is added it takes on an IdSale like 30537 or something.  

    I would expect the new blank database would start at 1.  Is this because in the past I've done a DELETE SaleItems and then a DELETE Sales improperly.  This is SQLServer CE database.  

    TIA

    Harry

    Thursday, September 26, 2019 6:53 PM

Answers

  • Hi,

    You can try to use "TRUNCATE TABLE" to empty the DataTable.

        truncate table tablename 

    Regards,

    Kyle


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Mimosa Arts Monday, September 30, 2019 4:27 PM
    Friday, September 27, 2019 2:42 AM
    Moderator

All replies

  • Hi,

    You can try to use "TRUNCATE TABLE" to empty the DataTable.

        truncate table tablename 

    Regards,

    Kyle


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Mimosa Arts Monday, September 30, 2019 4:27 PM
    Friday, September 27, 2019 2:42 AM
    Moderator
  • Thanks Kyle,

    I'll try the truncate since the link says the DELETE will not delete the index values.  Thanks

    Harry

    Monday, September 30, 2019 4:28 PM