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

  • SEARCH
  • Home
  • 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 6230041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:40:33+00:00 2026-05-24T09:40:33+00:00

I have a problem and I have researched Stackoverflow for answers without any luck.

  • 0

I have a problem and I have researched Stackoverflow for answers without any luck. I have manage to build a Stored Procedure that uses a function called GetSubtree_relvalue within it. The stored procedure and its function works just fine when the function has its parameters hard coded. But now I want the function to inherent the parameters that is sent in with the Stored procedure when it is executed.

When I replace XX and USA with @attribute_id and USA with @Client it doesn’t return anything. I have debugged it so far so that I can conclude that the function doesn’t get any values with it when it runs. This, even though these parameters in the Stored Procedure carries exactly the same value as the one that I have hard coded . (I checked with a regular select @client within the Procedure and it returns USA.)

Am I parametrizing the function wrongly? Do I need to initiate the functions parameter to be able to send it/pass it on to the function? How do get functions to inhere parameters?

I would be glad for all input regarding passing parameters forward from SP to functions.

Using SQL server 2008

Thanks

/Daniel


Function values hard coded

Insert into att_value_lookup (t.attribute_ID, t.att_value)
Select
t.attribute_ID, t.att_value 
From
(Select attribute_id, att_value from relvalue
where attribute_id in (
            Select attribute_id from (
                        select attribute_id 
                        from dbo.GetSubtree_relvalue('XX','USA'))
 ) as t

Function values parameterized

Insert into att_value_lookup (t.attribute_ID, t.att_value)
Select
t.attribute_ID, t.att_value 
From
(Select attribute_id, att_value from relvalue
where attribute_id in (
            Select attribute_id from (
                        select attribute_id 
                        from dbo.GetSubtree_relvalue('@attribute_id','@client'))
 ) as t

  • 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-05-24T09:40:33+00:00Added an answer on May 24, 2026 at 9:40 am

    remove the quotes!!

    dbo.GetSubtree_relvalue('@attribute_id','@client')
    

    should be:

    dbo.GetSubtree_relvalue(@attribute_id,@client)
    

    you only need them when passing in literal string values like ‘XX’ and ‘USA’, not when passing in variables. You were actually passing in strings that contained the variable names: ‘@attribute_id’, ‘@client’ and not the values contained within the variables.

    you can check it out:

    DECLARE @x varchar(10)
    SET @x='wow wee!!'
    print '@x'
    print @x
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have problem with fancybox. I want to write a function that will run
I have problem in some JavaScript that I am writing where the Switch statement
I have a rather interesting problem. I have a parent page that will create
Here is my problem. For example I have a table Products that contains a
I have a very specific problem. I have a user control (code below) That
I researched this around and still can't seem to solve this problem. I have
I have problem with return statment >.< I want to store all magazine names
I have problem with starting processes in impersonated context in ASP.NET 2.0. I am
I have problem compilin this code..can anyone tell whats wrong with the syntax CREATE
I have problem with ActionLink. I'd like to pass to my ActionLink parameter for

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.