# Primary Key question

**URL:** <https://forum.servoy.com/t/primary-key-question/331>\
**Category:** Classic Servoy\
**Created:** [September 15, 2003, 3:09pm UTC](https://forum.servoy.com/t/primary-key-question/331 "2003-09-15T15:09:26Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)\
**Post date:** [September 15, 2003, 3:09pm UTC](https://forum.servoy.com/t/primary-key-question/331/1 "2003-09-15T15:09:26Z")

</div>

Hello, I have a situation where I have to import data using MS SQL Server tools. Now there is a problem with primary keys: it looks like Servoy “counts” a sequence itself instead using a sequence from the database. If an ID is a primary key column managed by Servoy, you cannot use the database to move data around for the sequence won’t be updated in that case and the import fails (because NULL values are entered in a non-NULL column). If you set the ID to have a database managed sequence, Servoy has a problem since it relies on it’s own sequence handling.

Am I getting this right? What can we do if we encounter a situation like the one described?

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [September 15, 2003, 3:23pm UTC](https://forum.servoy.com/t/primary-key-question/331/2 "2003-09-15T15:23:49Z")

</div>

Yes currently servoy uses it’s own sequences. Currently we can’t handle database sequences that is planned for release 1.5 (then we will have database dependend features in servoy)

if you move data from one database to another database and you regenerate the pk’s there how do you keep youre Foreign key’s in sync?

---

<div class="post-metadata">

**Author:** ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)\
**Post date:** [September 15, 2003, 3:32pm UTC](https://forum.servoy.com/t/primary-key-question/331/3 "2003-09-15T15:32:09Z")

</div>

I can’t. My situation to start from scratch. I will be taking care of keys myself. I am moving from a system where everything was in sync, so all I have to to is update my date after import accordingly.

At least I can set the sequence in Servoy, can’t I. So during import I can use database driven sequences, then figure out the highest value and enter something bigger than that in Servoys data provider, right?

It’s quite a lot of work, though.

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [September 15, 2003, 6:58pm UTC](https://forum.servoy.com/t/primary-key-question/331/4 "2003-09-15T18:58:14Z")

</div>

After the import with db sequences you can sync servoy with those sequences to open the data providers dialog and open the properties of the pk dataprovider. Then in the sequence tab you can push the refresh button.

---

<div class="post-metadata">

**Author:** ![mpwiedemann](https://avatars.discourse-cdn.com/v4/letter/m/7993a0/32.png) [@mpwiedemann](https://forum.servoy.com/u/mpwiedemann)\
**Post date:** [September 15, 2003, 10:11pm UTC](https://forum.servoy.com/t/primary-key-question/331/5 "2003-09-15T22:11:51Z")

</div>

If the native DB sequences are to be released in version 1.5, does this mean we need to wait through versions 1.2, 1.3 and 1.4? ![:shock:]( "Shocked") Or, is 1.5 to be the next release?

---

<div class="post-metadata">

**Author:** ![Jan\_Blok](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@Jan\_Blok](https://forum.servoy.com/u/Jan_Blok)\
**Post date:** [September 18, 2003, 10:57am UTC](https://forum.servoy.com/t/primary-key-question/331/6 "2003-09-18T10:57:54Z")

</div>

1.5 will be next version after 1.2 becouse of the major enhancements we do

---

<div class="post-metadata">

**Author:** ![mpwiedemann](https://avatars.discourse-cdn.com/v4/letter/m/7993a0/32.png) [@mpwiedemann](https://forum.servoy.com/u/mpwiedemann)\
**Post date:** [September 18, 2003, 4:27pm UTC](https://forum.servoy.com/t/primary-key-question/331/7 "2003-09-18T16:27:11Z")

</div>

Great! The native key thing is very important to me. You guys are doing an awesome job responding to your customers!

Thanks,  
Martin Wiedemann

---

<div class="post-metadata">

**Author:** ![Bert](https://avatars.discourse-cdn.com/v4/letter/b/9e8a1a/32.png) [@Bert](https://forum.servoy.com/u/Bert)\
**Post date:** [September 18, 2003, 5:31pm UTC](https://forum.servoy.com/t/primary-key-question/331/8 "2003-09-18T17:31:34Z")

</div>

> mpwiedemann:  
> You guys are doing an awesome job responding to your customers!

For that’s a FACT ![8)]( "Cool") … keep up the good work ![:wink:]( "Wink")

---

<div class="post-metadata">

**Author:** ![edward](https://avatars.discourse-cdn.com/v4/letter/e/90db22/32.png) [@edward](https://forum.servoy.com/u/edward)\
**Post date:** [September 18, 2003, 8:42pm UTC](https://forum.servoy.com/t/primary-key-question/331/9 "2003-09-18T20:42:21Z")

</div>

With great feedback and commitment from customers we like to make sure its a win:win scenario!
