When you log LINQ-to-SQL's query output via the "Log" property on the DataContext object, you get output similar to:
SELECT [t0].[fullaname], [t0].[Worker], [t0].[Office]
FROM [dbo].[Workers] AS [t0]
WHERE [t0].[OfficeID] = @p0
ORDER BY [t0].[Name]
-- @p0: Input Int (Size = 0; Prec = 0; Scale = 0) [412]
-- Context: SqlProvider(Sql2005) Model: AttributedMetaModel Build: 3.5.30729.1
In this example, I'm just pulling back some information about every "Worker" in the Office with ID = 412. However, this output does not execute directly in a SQL Management Studio Query window, because of the "@p0" commented format that LINQ outputs.
Does anyone know if there is a stored procedure that takes this format so I can execute it? I looked at the paramaterized query procs, but maybe I'm just not seeing it. If there's no procedure, I'm about to write a parser that will turn this format into "normal" SQL...
Thanks!
Note:
I know I could just Define @p0 at the top of this, as shown in http://stackoverflow.com/questions/1705939/help-with-sql-linq-debugging, but - a lot of these queries I have take like 20 parameters, so it becomes a lot of work copying and pasting....