獲得當前登入使用者的所有資料庫及對應的表

2021-08-31 04:43:44 字數 724 閱讀 1331

[size=large]在mysql 下:

[color=orange]

//查詢當前登入使用者下的所有資料庫

select schema_name from information_schema.schemata

//根據資料庫名查詢對應的表

select count(*) tables, table_schema from information_schema.tables where table_schema = '資料庫' group by table_schema;[/color]

在sqlserver下:

[color=orange]select name from sys.databases --返回資料庫名

select name from sys.tables --返回表名

select table_name from information_schema.tables --返回表名

select name from sys.tables where type='u'--返回非系統表名[/color]

在oracle下:

[color=orange]//查詢所有使用者建立的表

select * from user_tables

//查詢某個資料庫下的所有表

select * from sys.all_tables where owner = 'qiaqia' [/color][/size]

資料庫獲得當前時間getdate

convert nvarchar 10 count time,121 convert為日期轉換函式,一般就是在時間型別 datetime,smalldatetime 與字串型別 nchar,nvarchar,char,varchar 相互轉換的時候才用到的函式的3個引數,第1個引數為,轉換後的大小,...

oracle檢視當前所有資料庫及資料庫基本操作命令

1.oracle 1 啟動 監聽 lsnrctl start 2 進入sqlplus介面 sqlplus nolog sql conn sys jiaxiaoai orcl as sysdba 3 啟動資料庫例項 sql startup 4 檢視當前所有的資料庫 select from v data...

怎樣獲得當前登入頁面的使用者的資訊(域帳戶)

怎樣獲得當前登入頁面的使用者的資訊 域帳戶 我用下面方法獲得的全是空的 string userdomain user.identity.name.trim 問題點數 100 回覆次數 4 topsystem.security.principal.windowsidentity.getcurrent ...