Skip to main content
Solved

Sequence Number Generation(FSM)

  • February 17, 2021
  • 1 reply
  • 337 views

Forum|alt.badge.img+7

Hi Community,

While updating multiple records using insert SQL command to the tab level, We are not able to generate multiple sequence(design_id ) which is the primary key and getting below error. 

 

Can anyone suggest what is the best way we can generate sequence for multiple records through SQL command. 

 

Thanks,

Ramya

Best answer by AdrianEgley

@Ramya 

This might help.

select coalesce(max(table_name.column_name),0) from table_name) + row_number() over (order by 1/0) design_id,

 

You will just need to add in your table and column names for your object.

Assuming you have a script to get some data in the first place, place this in the select where the design_id column would be.

 

But as ever. SQL / Inserting, be careful and test.

 

Ady

This topic has been closed for replies.

1 reply

AdrianEgley
Hero (Customer)
Forum|alt.badge.img+14
  • Hero (Customer)
  • Answer
  • February 17, 2021

@Ramya 

This might help.

select coalesce(max(table_name.column_name),0) from table_name) + row_number() over (order by 1/0) design_id,

 

You will just need to add in your table and column names for your object.

Assuming you have a script to get some data in the first place, place this in the select where the design_id column would be.

 

But as ever. SQL / Inserting, be careful and test.

 

Ady