|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Friday, June 07, 2013 3:53 AM
Points: 161,
Visits: 840
|
|
create procedure outname @Cont Int, @Nm Nvarchar (100) output as select @Nm=FirstName from AdventureWorks.Person.Contact where ContactID=@Cont
declare @Nam Nvarchar (100) exec outname 112, @Nam=@Nm output select @Nam
is giving error as "Must declare the scalar variable "@Nm"."
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 4:08 PM
Points: 38,099,
Visits: 30,392
|
|
Firstly you're missing a GO after the procedure's declaration The assignment in the procedure's execution is the wrong way around. It's Parameter = Variable/Constant, not Variable = Parameter.
create procedure outname @Cont Int, @Nm Nvarchar (100) output as select @Nm=FirstName from AdventureWorks.Person.Contact where ContactID=@Cont GO
declare @Nam Nvarchar (100) exec outname 112, @Nm=@Nam output select @Nam
Gail Shaw Microsoft Certified Master: SQL Server 2008, MVP SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter We stand on the bridge and no one may pass
|
|
|
|