Sql server 在SQL Server Management Studio中恢复未保存的SQL查询脚本

Sql server 在SQL Server Management Studio中恢复未保存的SQL查询脚本,sql-server,Sql Server,从何处恢复SQL server Management Studio中未保存的SQL脚本 我已签入以下路径: %USERPROFILE%\Documents\SQL Server Management Studio\Backup Files` 但未找到任何脚本。如果未超过24小时,您可以使用 Use <database> SELECT eq.last_execution_time AS [Date Time], es.text AS [Script] FROM sys.

从何处恢复SQL server Management Studio中未保存的SQL脚本

我已签入以下路径:

%USERPROFILE%\Documents\SQL Server Management Studio\Backup Files`

但未找到任何脚本。

如果未超过24小时,您可以使用

Use <database>
SELECT 
  eq.last_execution_time AS [Date Time], 
  es.text AS [Script] 
FROM sys.dm_exec_query_stats AS eq
CROSS APPLY sys.dm_exec_sql_text(eq.sql_handle) AS es
ORDER BY eq.last_execution_time DESC

仍然无法恢复,还有什么其他方法可以恢复吗?从你的错误中吸取教训;保存您打算在将来保留的脚本。
%USERPROFILE%\Documents\SQL Server Management Studio\Backup Files

%USERPROFILE%\AppData\Local\Temp