postgresql
1.查询当前数据库:
终端:\c
sql语句:select current_database();
2.查询当前用户:
终端:\c
sql语句:select user; 或者:select current_user;
sqlserver
SELECT COUNT
( 0 )
FROM
information_schema.tables
WHERE
table_catalog = ( SELECT DB_NAME ( ) )
AND TABLE_NAME NOT LIKE’qrtz_%’
AND TABLE_NAME NOT LIKE’gen_%’
AND TABLE_NAME NOT IN ( SELECT TABLE_NAME FROM gen_table )