Hi
Is there any DS-commond line query to reset Surrogate Key ?
Thanks
How to Reset Surrogate Key ?
Moderators: chulett, rschirm, roy
Which surrogate key are you talking about? If you are referring to a Database's internal one then no, there is direct command to do so, you need to issue an SQL call.
If you are talking about the DataStage generated keys using the KeyMgtGetNextValue then yes, there is a way to reset this key; the values are stored in a file called SDKSequences and the key to this file is the name you supply the routine for the sequence. If you remove this record then you have effectively reset the key.
If you are talking about the DataStage generated keys using the KeyMgtGetNextValue then yes, there is a way to reset this key; the values are stored in a file called SDKSequences and the key to this file is the name you supply the routine for the sequence. If you remove this record then you have effectively reset the key.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
nraj,
you can call "DSExecute('UV','DELETE SDKSequences {yourKey}',CommandOutput,ErrorCode)" which will remove the record and then the next time you use the sequence {yourKey} it will start at 0 again. If you plan on doing this often then it would be worth creating a short function such as KeyMgtResetValue that will do the job.
The SQL call is dependant upon the database you are using
you can call "DSExecute('UV','DELETE SDKSequences {yourKey}',CommandOutput,ErrorCode)" which will remove the record and then the next time you use the sequence {yourKey} it will start at 0 again. If you plan on doing this often then it would be worth creating a short function such as KeyMgtResetValue that will do the job.
The SQL call is dependant upon the database you are using
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
If you go into the manager you can look at the source code for KeyMgtResetValue. It is quite simple and straightforward to read the BASIC code and it should show you how you could make your own copy of this routine that will reset the value and/or restart the value at some other position. I would write a function with an extra parameter.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
Hi Saravanan
Whenever you want to reset this then you need to update the value in universe.
Syntax:
UPDATE SDKSequences USING DICT VOC SET F1 = 'New_Value' WHERE @ID = 'Sequence_Name';
You can use this in the before/after subroutine or create a function of your own.
Thanks
Whenever you want to reset this then you need to update the value in universe.
Syntax:
UPDATE SDKSequences USING DICT VOC SET F1 = 'New_Value' WHERE @ID = 'Sequence_Name';
You can use this in the before/after subroutine or create a function of your own.
Thanks
Regards
Siva
Listening to the Learned
"The most precious wealth is the wealth acquired by the ear Indeed, of all wealth that wealth is the crown." - Thirukural By Thiruvalluvar
Siva
Listening to the Learned
"The most precious wealth is the wealth acquired by the ear Indeed, of all wealth that wealth is the crown." - Thirukural By Thiruvalluvar