AnsweredAssumed Answered

How can I access a SQL Server 2012 database sequence value in arcpy

Question asked by jwfox1 on Jul 12, 2016
Latest reply on Jul 22, 2016 by bixb0012

I had python script tool that accessed a sequence value and got the

value via arcpy.ArcSDESQLExecute call. We are porting our SDE environment

from Oracle 11g to SQL Server 2012 and as such changed the sequence select

from ALL_SEQUENCES to sys.sequences as shown:



        select_list = 'SELECT DISTINCT current_value ' #  SELECT LAST_NUMBER '

        from_clause = 'FROM sys.sequences ' # ' FROM ALL_SEQUENCES '

        where_clause = 'WHERE NAME = \''+seq_name+'\' ' # 'WHERE SEQUENCE_OWNER = \'' + schema + '\' AND SEQUENCE_NAME



This SQL works in SSMS or SQL_CMD but not in arcpy (it did work correctly in Oracle 11g)



is there now an arcpy call that will get a sequence value (CURRVAL) directly without

building SQL and using ArcSDESQLExecute?