Extracting a sequence value

I have a sequence, call it mySequence, in SQL Server. I’d like to extract
the next sequence number (an integer) via Lucee. So far my efforts have
failed.

I’ve created a query as below.

 <cfquery name="getMySequence" datasource="myDatabase" >

    Select next value for mySequence

  </cfquery>

The result is not an integer, it is a query variable. This looks to be the
wrong approach. What is the better way?

I’ve never worked with sequences in SQL Server. What do you get if you
do a dump? i.e.

 <cfdump var="#getMySequence#">

?

Igal Sapir
Lucee Core Developer
Lucee.org http://lucee.org/On 6/7/2016 3:32 PM, Randall Senn wrote:

I have a sequence, call it mySequence, in SQL Server. I’d like to
extract the next sequence number (an integer) via Lucee. So far my
efforts have failed.

I’ve created a query as below.

 <cfquery name="getMySequence" datasource="myDatabase" >

    Select next value for mySequence

  </cfquery>

The result is not an integer, it is a query variable. This looks to
be the wrong approach. What is the better way?


Win a ticket to dev.objective from Lucee via Twitter, see
http://bit.ly/1UbTMWj for details, good luck and see you there…

You received this message because you are subscribed to the Google
Groups “Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to lucee+unsubscribe@googlegroups.com
mailto:lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com
mailto:lucee@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/af0850d1-a89f-45ae-a394-5f20129c974d%40googlegroups.com
https://groups.google.com/d/msgid/lucee/af0850d1-a89f-45ae-a394-5f20129c974d%40googlegroups.com?utm_medium=email&utm_source=footer.
For more options, visit https://groups.google.com/d/optout.

OR:

SELECT current_value, increment FROM sys.sequences WHERE name = ‘MySequence’

nextNum = getMySequence.current_value + getMySequence.increment;

SELECT current_value FROM sys.sequences WHERE name = ‘MySequence’

nextNum = getMySequence.current_value + 1;