Reputation: 329
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
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