On SQL Server, I'm trying to alter sequence on a remote server using this:
ALTER SEQUENCE SeverName.DbName.sys.SeqName_sequence RESTART WITH 1000;
Unfortunately, this does not work. Does anyone know if this is possible and the correct syntax?
You can do this using dynamic SQL, and specify that database's sp_executesql
procedure.
DECLARE @sql nvarchar(max) = '
ALTER SEQUENCE SomeSchemaName.SomeSequenceName RESTART WITH 1000;
';
EXEC SeverName.DbName.sys.sp_executesql @sql;