• Mybatis implementation of SQL query interception modification


    preface One of the functions of interceptors is that we can intercept the calls of some methods. We can choose to add some logic before and after the execution of these intercepted methods, or we can execute our own logic when executing these intercepted methods instead of executing the intercepted methods. An original intention of […]

  • Three methods of querying SQL server startup time


    In the morning, I’m analyzing the usage of the index. I want to see when the database was started to ensure that there is no problem with the statistical data. I can use the following three methods to query: –2008 and later SELECT sqlserver_start_time FROM sys.dm_os_sys_info select crdate from master..sysdatabaseswherename=’tempdb’ SELECT login_time FROMsysprocesses WHEREspid= 1

  • The method of querying the last rebuild time of SQL Server index


    A friend has a job whose execution of rebuild index has stopped. He asked me if I could check which indexes have been rebuilt. I thought Sys.index perhaps Sys.objects Similar information will be stored and not found.  Check from the Internet, SQL server does not store similar information. But because rebuild index will update statistics […]

  • SQL statement query SQL server server name and IP address


    Get server name: SELECT SERVERPROPERTY(‘MachineName’) select @@SERVERNAME select HOST_NAME() Get IP address can use XP_ Cmdshell executes ipconfig command: –Open XP_ cmdshell exec sp_configure’show advanced options’, 1 reconfigure with override exec sp_configure’xp_cmdshell’, 1 reconfigure with override exec sp_configure’show advanced options’, 0 reconfigure with override go begin declare @ipline varchar(200) declare @pos int declare @ip varchar(40) […]

  • SQL statement query SQL server memory usage


    Select type, – type of clerk sum(virtual_ memory_ reserved_ kb)as vm_ Reserved_ KB, – reserved memory sum(virtual_ memory_ committed_ kb)as vm_ Committed_ KB, – committed memory sum(awe_ allocated_ kb)as awe_ Allocated_ KB, – memory used after awe is turned on sum(shared_ memory_ reserved_ kb)as sm_ Reserved_ KB, – shared reserved memory sum(shared_ memory_ committed_ kb)as […]

  • SQL statement to query index usage


    SELECT sch.name + ‘.’ + t.name AS [Table Name], i.name AS[Index Name], i.type_desc, ISNULL(user_updates,0) AS [Total Writes], ISNULL(user_seeks +user_scans + user_lookups,0) AS [Total Reads], s.last_user_seek, s.last_user_scan , s.last_user_lookup, ISNULL(user_updates,0) – ISNULL((user_seeks+ user_scans +user_lookups),0)AS [Difference], p.reserved_page_count * 8.0 / 1024 as SpaceInMB FROM sys.indexes AS i WITH (NOLOCK) LEFT OUTERJOIN sys.dm_db_index_usage_statsAS s WITH (NOLOCK) ON s.object_id […]

  • Example of using query generator query() in yii2 framework


    This article describes the use of query generator query () in yii2 framework. The details are as follows: Yii / db / query in yii2 provides us with rich methods to build complex SQL statements. The biggest difference between query () and create command is that the latter directly uses the SQL statements we have […]

  • SQL statement to query the current database IO waiting status


    sys.dm_ io_ pending_ io_ Requests can return the Current IO pending status. For each pending I / O request in SQL server, a corresponding line is returned, followed by sys.dm_ io_ virtual_ file_ With stats, you can see which database IO has problems. select DB_NAME(database_id) as DBNAME, database_id, file_id, io_stall, io_pending_ms_ticks, scheduler_address from sys.dm_io_virtual_file_stats(null,null)i , […]

  • SQL server query database tables using spatial information to achieve scripts


    It uses the private stored procedure SP provided by Microsoft_ MSforeachtable   CREATE TABLE #temp ( TableName NVARCHAR (128), RowsCnt VARCHAR (11), ReservedSpace VARCHAR(18), DataSpace VARCHAR(18), CombinedIndexSpace VARCHAR(18), UnusedSpace VARCHAR(18) ) EXEC sp_MSforeachtable’INSERT INTO #temp (TableName, RowsCnt, ReservedSpace,DataSpace, CombinedIndexSpace, UnusedSpace) EXEC sp_spaceused ”?”, FALSE’ SELECT TableName, RowsCnt,ReservedSpace, DataSpace, CombinedIndexSpace, UnusedSpace FROM #temp ORDER BY TableName […]

  • The way of jumping between Vue routes and opening new windows (query, params)


    Inter route hop configuration: Query mode The parameters are displayed in the URL this.$router.push({ //Query mode path: “/a”, query: { projectDetails: val }, Params mode The parameter transfer data will not be displayed in the navigation bar. It needs to be used with the name attribute of the route //Params mode name: ‘a’, params: { […]

  • JSP operation MySQL query / insert / delete function example


    Paste the code directly:First, index_ test.jsp The code of the page is as follows: Copy codeThe code is as follows: <%@ page language=”java” pageEncoding=”utf-8″%> <%@ page contentType=”text/html;charset=utf-8″%>&nbsp; <%&nbsp; &nbsp; &nbsp;request.setCharacterEncoding(“UTF-8”);&nbsp; &nbsp; &nbsp;response.setCharacterEncoding(“UTF-8”);&nbsp; &nbsp; &nbsp;response.setContentType(“text/html;charset=utf-8”);&nbsp; %> <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd”> <html xmlns=”http://www.w3.org/1999/xhtml”> <head> < title > personnel operation<META http-equiv=Content-Type content=”text/html; charset=utf-8″> <style> […]

  • Yii2.0 framework database operation simple example [add, modify, delete, query, print, etc.]


    This paper describes the yii2.0 framework database operation with an example. The details are as follows: add to $id = \Yii::$app->db ->createCommand() ->Insert (‘table name ‘, [‘car_ num’ => $car_ num, ‘lg_ shop_ id’ => $shop_ id]) ->execute(); Batchinsert(): add multiple rows at a time // table name, column names, column values Yii::$app->db->createCommand()->batchInsert(‘user’, [‘name’, ‘age’], […]