Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Creating Sequence START WITH Calculated Value
Message
De
14/10/2021 14:29:45
 
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Creating Sequence START WITH Calculated Value
Divers
Thread ID:
01682524
Message ID:
01682524
Vues:
40
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
Répondre
Fil
Voir

Click here to load this message in the networking platform