November 18, 2013 at 2:43 pm
Hi Professional.
I have a procedure which creates a file with column headings like so
alter procedure [dbo].[extractnewheadings]
@importedquery nvarchar(1000)
as
begin
Declare @sCmd varchar(256)
SET @sCmd = 'echo ' + @importedquery + ' > "C:\inetpub\wwwroot\cleansed\headingsonly.csv"'
exec master..xp_cmdshell @sCmd, no_output
end
exec extractnewheadings 'softwaremanufacturer,productname,productversion,Ldate,licensable'
it produces an error which I cannot seem to rectify
Msg 217, Level 16, State 1, Procedure extractnewheadings, Line 11
Maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32).
any ideas where I could be going wrong
November 18, 2013 at 2:49 pm
my first guess is that you ar emissing a GO statement;
you've got the CREATE / ALTER, and then a call of the same proc on the last line...so it calls itself over and over, and i doubt that's what you wanted to do:
i think this is what you wanted instead:
alter procedure [dbo].[extractnewheadings]
@importedquery nvarchar(1000)
as
begin
Declare @sCmd varchar(256)
SET @sCmd = 'echo ' + @importedquery + ' > "C:\inetpub\wwwroot\cleansed\headingsonly.csv"'
exec master..xp_cmdshell @sCmd, no_output
end
GO
exec extractnewheadings 'softwaremanufacturer,productname,productversion,Ldate,licensable'
Lowell
November 18, 2013 at 3:02 pm
Hi Lowell
that's worked perfect thanks so much
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply