By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,760 Members | 1,630 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,760 IT Pros & Developers. It's quick & easy.

Problem running stored procedure

P: 2

I want to use a stored procedure inside a stored procedure simulteanously changing the database.
this is my base store procedure

alter PROCEDURE create_file @dbname sysname
declare @fname varchar(30)
declare @fsizes nvarchar
DECLARE @cmd varchar(1000)
set @cmd = 'osql -E -d ' + @dbname + ' -Q "exec ret_sizes @fname OUTPUT,@fsizes OUTPUT"'
exec master..xp_cmdshell @cmd

if i execute the his "exec create_file ertis"
i get error as

Msg 137, Level 15, State 2, Server HCC-BPVHD1, Line 1
Must declare the variable '@fname'.

the procedure called inside the mail procedure is

alter procedure ret_sizes
@fname varchar(30) OUTPUT,
@fsizes nvarchar OUTPUT
select @fname=name, @fsizes=size from sysfiles
order by fileid

Please help me and not why it is getting eror.
Sep 16 '06 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.