nancyd1111
Technical User
I'm trying to pass in a varible to a stored proc and I'm not having success.
If I don't use a variable, a trace file is created. If I use a variable, the trace file is not created. Any idea why?
This works when I hard code the drive and filename:
exec @rs = sp_trace_create @traceid output, 0, N'\\AUTOPILOT\cdrive\Trace\Trace'
This does NOT work when I pass in a variable as a parameter to the stored proc:
@PlanName varchar(255)
declare @filename varchar(255)
set @filename = '\\AUTOPILOT\cdrive\Trace\Trace_' + @PlanName
exec @rs = sp_trace_create @traceid output, 0, N@filename
PlanName is passed in when calling the stored procedure and filename is comprised of text + PlanName.
The exec state to create the file, returns a value of "12" File Not Created.
Thanks in advance!
If I don't use a variable, a trace file is created. If I use a variable, the trace file is not created. Any idea why?
This works when I hard code the drive and filename:
exec @rs = sp_trace_create @traceid output, 0, N'\\AUTOPILOT\cdrive\Trace\Trace'
This does NOT work when I pass in a variable as a parameter to the stored proc:
@PlanName varchar(255)
declare @filename varchar(255)
set @filename = '\\AUTOPILOT\cdrive\Trace\Trace_' + @PlanName
exec @rs = sp_trace_create @traceid output, 0, N@filename
PlanName is passed in when calling the stored procedure and filename is comprised of text + PlanName.
The exec state to create the file, returns a value of "12" File Not Created.
Thanks in advance!