Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Creating Sequence START WITH Calculated Value
Message
From
14/10/2021 14:29:45
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Creating Sequence START WITH Calculated Value
Miscellaneous
Thread ID:
01682524
Message ID:
01682524
Views:
39
Ignore! I found it with a slight change in search terms

https://stackoverflow.com/questions/26913634/how-to-set-start-with-of-sequence-to-select-query-result-in-sql-server

Hi,
I need to create a sequence and start it from generating from a calculated value like this:
CREATE SEQUENCE batchnumber 
    AS [integer]
    START WITH (select max(bat_number) + 1 from Batches where bat_brnfk = (select app_itemvalue from appinfo where app_item = 'branchpk'))  
    INCREMENT BY 1  
	NO CACHE
go
I get a red squiggly line under the left bracket after "START WITH": Incorrect syntax near '('. Expecting '+','-', INTEGER, or NUMERIC.

Is there a way to populate the START WITH like this?
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Reply
Map
View

Click here to load this message in the networking platform