In SQL Server, the COUNT and COUNT_BIG are aggregte functions that return the number of rows. COUNT returns INT, while COUNT_BIG returns BIGINT.
In PostgreSQL, you can use the COUNT function that returns BIGINT.
Consider the following sample table:
CREATE TABLE colors (name VARCHAR(30), category CHAR(1)); -- Insert sample rows INSERT INTO colors VALUES ('Green', 'G'); INSERT INTO colors VALUES ('White', 'W'); INSERT INTO colors VALUES ('Black', 'B');
SQL Server:
-- Get the number of rows SELECT COUNT(*) FROM colors; # 3
PostgreSQL:
-- Get the number of rows SELECT COUNT(*) FROM colors; # 3
For more information, see SQL Server to PostgreSQL Migration.