string strConn = "server=localhost;Integrated Security=yes; ..."; // Set up the SQL Connection String and Parameters array SqlParameter[] arParms = new SqlParameter[2]; arParms[0] = new SqlParameter("@cUnknown", SqlDbType.VarChar, 10); arParms[0].Value = "MyValue"; arParms[1] = new SqlParameter("@MasterRef", SqlDbType.VarChar, 10); arParms[1].Direction = ParameterDirection.ReturnValue; SqlHelper.ExecuteNonQuery(strConn, CommandType.StoredProcedure, "dbo.ResolveToMaster", arParms); string MyValue = arParms[1].Value.ToString();Bill
> >FUNCTION ResolveToMaster (@cUnknown varchar(10)) >RETURNS varchar(10) >AS >begin > > >declare @MasterRef varchar(10) > >select @MasterRef = null > > >select @MasterRef = (Select Distinct MasterRef from Claim where MasterRef = @cUnknown) > >if @MasterRef is null >begin > select @MasterRef = (Select Distinct MasterRef from Claim where CustomerRef = @cUnknown) > >end > >if @MasterRef is null > begin > select @MasterRef = (Select Distinct MasterRef from Claim where ClaimRef = @cUnknown) > > end > > >Return @MasterRef >end > >>