I have a simple stored procedure
CREATE PROCEDURE [dbo].[simple]
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
DECLARE @sql NVARCHAR(MAX)
SELECT @sql = '
SELECT TOP(5) * FROM aTable'
PRINT @sql
EXEC sp_executesql
@sql
END
And now, in C#, I want to get, if is possible, the @sql value from stored procedure (after it was executed).
I use Sql Server 2005.
How to do that in C#?
From the comments, you want access to
@sqlfrom C# code after calling the method. So:then simply in your ADO.NET code: