Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get sequence name list in sqlserver?

Tags:

sql-server

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?

like image 253
liu246437 Avatar asked Oct 21 '25 13:10

liu246437


2 Answers

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
like image 77
Panagiotis Kanavos Avatar answered Oct 24 '25 20:10

Panagiotis Kanavos


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

enter image description here

like image 24
Rodney Ellis Avatar answered Oct 24 '25 20:10

Rodney Ellis