有的时候,需要知道近段时间SQLSERVER执行了什么语句,可以用下面的方法: SELECT TOP 1000 QS.creation_time, SUBSTRINGST.text, QS.statement_start_offset / 2) + 1, CASE QS.statement_end_offset WHEN - 1 THEN DATALENGTHst.text) ELSE QS.statement_end_offset END - QS.statement_start_offset) / 2) + 1) AS statement_text, ST.text, QS.total_worker_time, QS.last_worker_time, QS.max_worker_time, QS.min_worker_time FROM sys.dm_exec_query_stats QS CROSS APPLY sys.dm_exec_sql_textQS.sql_handle) ST WHERE QS.creation_time BETWEEN '2017-09-09 10:00:00' AND '2017-09-11 18:00:00' AND ST.text LIKE '%%' ORDER BY QS.creation_time DESC --备忘2019.9 字符串int 拼接 SELECT 'a-' + CONVERTvarchar50), log_ID) AS Expr1, log_Title, log_Url FROM blog_Article ntext类型字段长度 DATALENGTHlog_Content) 想要使用replace函数去更新表中字段类型为ntext的话,要用到cast函数 update Article set content=replacecastcontent as varchar4000),'like','love') where id>36
转载 : https://www.cnblogs.com/qianduan/p/7146313.html