SQL Server Profiler 不显示 SQL 语句中的数据

SQL Server Profiler does not show data in SQL statement

我正在使用 SQL Server Profiler 在 Windows SmartClient 应用程序中跟踪从 nHibernate 生成的 SQL。 SQL 语句的跟踪不显示实际数据,而是看起来像这样:

exec sp_executesql N'SELECT attachment0_.RecordKey as RecordKey1_, attachment0_.Id as Id1_, attachment0_.Id as Id87_0_, attachment0_.RecordType as RecordType87_0_, attachment0_.RecordKey as RecordKey87_0_, attachment0_.FileName as FileName87_0_, attachment0_.OriginalFileName as Original6_87_0_, attachment0_.DateTimeAttached as DateTime7_87_0_ FROM MyDatabase.dbo.tblAttachment attachment0_ WHERE attachment0_.RecordKey=@p0',N'@p0 int',@p0=262

有没有办法在 SQL 命令中查看实际数据?

它只是显示参数化的sql。如果你想记录或显示非参数化 sql 我在这里想出了一个解决方案:

Execute NHibernate-generated prepared statements in SQL Server Management Studio

注意事项是 log4net appender,它基本上将此翻译成已接受的答案。