Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8980637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:08:14+00:00 2026-06-15T20:08:14+00:00

I am new to SQL and trying to write a stored procedure. I am

  • 0

I am new to SQL and trying to write a stored procedure. I am having some difficulties to get default values as an output result.

I have 2 table:

Student_Input:

InputID SectionID  ParameterName    Sequence
------------------------------------------------     
  1     100        FirstName           1 
  2     100        MiddleName          2  
  3     100        LastName            3  

Student_Input_details:

ParameterName   ParameterValue      DefaultValue
-----------------------------------------------------     
FirstName          John                  1    
FirstName          Troy                  0
FirstName          Mark                  0  

I am trying to call ParameterName from Student_Input and Its default value from Student_Input_Details as an output in one table. I am trying with following query but I am getting following error:

Msg 201, Level 16, State 4, Procedure Getparameterdefaultvalues, Line 0
Procedure or function ‘Getparameterdefaultvalues’ expects parameter ‘@ParameterValue’, which was not supplied.

I am sure I am missing something important here.

My query is below. I am learning , it may be an easy question. Thx……..

CREATE PROCEDURE Getparameterdefaultvalues
(
    @ParameterName varchar(50) ,
    @ParameterValue varchar(50) OUT
)
AS
BEGIN
    SELECT @ParameterValue = DefaultValue FROM ParameterInput_Values
    WHERE ParameterName=@ParameterName 
END
DECLARE @ParameterValue varchar(50) 
EXEC Getparameterdefaultvalues @ParameterName = 1, @ParameterValue OUTPUT
PRINT 'Result is: ' + @ParameterValue

I need result like (i.e. ParameterName should only display its default value at runtime):

ParameterName   ParameterValue      
---------------------------------- 
FirstName         John

I have tried on other blogs but couldn’t resolve this. Apologies If my question is not so cleared. Any help would be great!! Thx

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T20:08:15+00:00Added an answer on June 15, 2026 at 8:08 pm

    Pretty simple and easy: your stored procedure expects two parameters – @ParameterName and @ParameterValue – but your call only supplies one…

    You should call your stored procedure like this:

    DECLARE @ParameterValue varchar(50) 
    
    EXEC Getparameterdefaultvalues @ParameterName = 1, @ParameterValue = @ParameterValue OUTPUT
    
    PRINT 'Result is: ' + @ParameterValue
    

    Also: you’re returning the retrieved value as an output parameter – so you’re getting back a single value into a variable – you’re not getting back a result set (rows/columns).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a stored procedure in SQL Server that will eliminate some
New to MVC3 Razor - linq to sql having spent some time trying to
I'm fairly new to SQL and was trying to write a procedure that would
I'm fairly new to SQL, but trying to write quite a complicated query, but
What's up with JNDI names? I'm trying to get a javax.sql.DataSource using the new
I am trying to write a SQL Server query but have had no luck
Here is a simplified version of a stored procedure I am trying to write
I'm trying to use a SQL Server stored procedure with ASP: ALTER PROCEDURE [dbo].[user_insert]
I am having some difficulty getting a pretty simple stored procedure right. Consider the
I'm trying to write a program using SQL and OleDB and I get an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.