简体   繁体   中英

Need help .Problem with SQL Server nextval query

I have a problem with the SQL query- nextval in a SQL Server database:

The multi-part identifier "applicationauth.nextvalue" could not be bound.

Any idea what could be wrong?

Here is query:

insert into applicationauth (app, optionname, conditionnum, groupname, applicationauthid) 
    select 'AUTOSCRIPT', 'ATTRVAL', 'ATTRVALUECON', varvalue, applicationauth.nextvalue
    from maxvars 
    where varname = 'ALLUSERGROUP';

insert into applicationauth (app, optionname, conditionnum, groupname, applicationauthid) 
    select 'AUTOSCRIPT', 'HIDEATTR', 'HIDEATTRCON', varvalue, applicationauthseq.nextval

insert into applicationauth (app, optionname, conditionnum, groupname, applicationauthid) 
    select 'AUTOSCRIPT', 'ATTRVAL', 'ATTRVALUECON', varvalue, applicationauthseq.nextval
    from maxvars 
    where varname = 'ALLUSERGROUP';

insert into applicationauth (app, optionname, conditionnum, groupname, applicationauthid) 
    select 'AUTOSCRIPT', 'HIDEATTR','HIDEATTRCON', varvalue, applicationauthseq.nextval
    from maxvars 
    where varname = 'ALLUSERGROUP';

insert into applicationauth (app, optionname, conditionnum, groupname, applicationauthid) 
    select 'AUTOSCRIPT', 'HIDEBUT', 'HIDEBUTCON', varvalue, applicationauthseq.nextval
    from maxvars 
    where varname = 'ALLUSERGROUP';

insert into applicationauth (app, optionname, conditionnum, groupname, applicationauthid) 
    select 'AUTOSCRIPT', 'HIDEIMP', 'HIDEIMPCON', varvalue, applicationauthseq.nextval
    from maxvars 
    where varname = 'ALLUSERGROUP';

(and so on and so forth ...)

I'm getting following error message:

Msg 4104, Level 16, State 1, Line 2
The multi-part identifier "applicationauth.nextvalue" could not be bound.

Msg 4104, Level 16, State 1, Line 9
The multi-part identifier "applicationauthseq.nextval" could not be bound.

(.... and so on and so forth)

Is this what you're looking for?

Replace applicationauthseq.nextval with NEXT VALUE FOR applicationauthseq .

Not sure where you got that initial syntax, but NEXT VALUE FOR is how you call a SEQUENCE object from T-SQL.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM