Search
 
SCRIPT & CODE EXAMPLE
 

SQL

sql select all records from all tables where not empty

SELECT r.table_name, r.row_count, r.[object_id]
FROM sys.tables t
INNER JOIN (
    SELECT OBJECT_NAME(s.[object_id]) table_name, SUM(s.row_count) row_count, s.[object_id]
    FROM sys.dm_db_partition_stats s
    WHERE s.index_id in (0,1)
    GROUP BY s.[object_id]
) r on t.[object_id] = r.[object_id]
WHERE r.row_count > 0
ORDER BY r.table_name;
Comment

PREVIOUS NEXT
Code Example
Sql :: oracle all dates between two dates 
Sql :: mysql changer nom table 
Sql :: sub query postgres 
Sql :: access no password in mysql mamp 
Sql :: mysql get max value and id 
Sql :: select value from previous row in postgresql 
Sql :: how to define a save method in ruby for sqlite3 databases 
Sql :: SQL Server query to get data for a particular date and time 
Sql :: oracle error line 
Sql :: how to get parent and child record in single query using sql 
Sql :: mysql sql select one day before 
Sql :: update set table column to null 
Sql :: client does not support authentication protocol requested by server sqlyog 
Sql :: how to delete database in mysql 
Sql :: sql output select 
Sql :: sql pivot rows to columns 
Sql :: mysql:5.6 syntax create table 
Sql :: oracle alter table add column 
Sql :: Create the connection pool mysql2 
Sql :: mariadb create index if not exists 
Sql :: sql insert into statement 
Sql :: flask-sqlalchemy filter_by contains 
Sql :: how to move a column to different spot mysql 
Sql :: how to create triggers in sql server 
Sql :: sql select data type of query 
Sql :: SQL Syntax of INNER JOIN 
Sql :: sql float 3 decimal places 
Sql :: openquery join two tables 
Sql :: case vhdl 
Sql :: sqlite3 visual table schema 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =