Jump to content

Simple SQL question


Tim Anderson
 Share

This topic is 4327 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I am starting to use simple SQL commands to create new records and cannot find a way to return the primary key from the record that was created.

Is there a combination of INSERT/SELECT that will do this for me?

Thanks

Tim

Link to comment
Share on other sites

Great thanks Andries, will try it.

You will need to send two command lines:

One to insert the record

"INSERT INTO TABLENAME"

and

Another one to retrieve the zkp

"SELECT MAX (ID) FROM TABLENAME"

the latest will give you the MAX of the ID.

Link to comment
Share on other sites

  • 1 month later...

Hi

This seems very great and I was playing with this for multiply create. However, everytime there is added a digit to the serial number, the select statement does not function...

e.g.

Create record, which gets pkID 9

When you create record that gets pkID 10 the select will stay on 9.

Only if you delete all records, it can go on with 12.....99 but then it has the same issue....

Does anyone know if this is normal, if it is a limitation in the Filemaker SQL functions or if it is a ScriptMaster issue ?

You will need to send two command lines:

One to insert the record

"INSERT INTO TABLENAME"

and

Another one to retrieve the zkp

"SELECT MAX (ID) FROM TABLENAME"

the latest will give you the MAX of the ID.

Link to comment
Share on other sites

Hi

This seems very great and I was playing with this for multiply create. However, everytime there is added a digit to the serial number, the select statement does not function...

e.g.

Create record, which gets pkID 9

When you create record that gets pkID 10 the select will stay on 9.

Only if you delete all records, it can go on with 12.....99 but then it has the same issue....

Does anyone know if this is normal, if it is a limitation in the Filemaker SQL functions or if it is a ScriptMaster issue ?

Is your pkID a Number field? It sounds like it is a simple text field, in that case 9 is bigger than 10... the same holds for 12..99, where 99 is bigger than 100 in a alphabetical sort.

edit: didn't read the previous post...

Link to comment
Share on other sites

This topic is 4327 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.