liu246437
liu246437

Reputation: 329

How to get sequence name list in sqlserver?

How to get list of sequence names in Postgres?

Today,I asked how to get the sequence name list in the postgresql,Thanks to DunnoHowToCode provides the answer for me.

Now,the same question I meet in sqlsever.I through

SELECT * FROM sys.SEQUENCES

to get it,but anything I can't get.I want to get the sequence name list by sql statement in sqlsever.How can I do it?

Upvotes: 4

Views: 28397

Answers (2)

Rodney Ellis
Rodney Ellis

Reputation: 807

You can view them in SSMS, in the Object Explorer:

enter image description here

Upvotes: 5

Panagiotis Kanavos
Panagiotis Kanavos

Reputation: 131523

sys.sequences isn't broken. Your query will return all the sequences in a database as long as there are any sequences in that database. If you don't get any results, it means that there aren't any sequences. Make sure you execute the query in the correct database. Better yet, include the database name in the query, ie:

select * from mydb.sys.sequences

Upvotes: 12

Related Questions