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 176175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T13:49:47+00:00 2026-05-11T13:49:47+00:00

I’m not sure how to resolve this error: Procedure or Function ‘sp_executesql’ expects parameter

  • 0

I’m not sure how to resolve this error:

Procedure or Function ‘sp_executesql’ expects parameter ‘@statement’, which was not supplied.

for this query:

DECLARE @a INT  DECLARE @b VARCHAR  SET @a = 1  WHILE @a < 30 BEGIN set @b = @a   exec sp_executesql update source_temp set pmt_90_day = pmt_90_day + convert(money,'trans_total_'+@b)+N'     N'where convert(datetime,'effective_date_'+@b)+N' <= dateadd(day,90,ORSA_CHARGE_OFF_DATE)     and DRC_FLAG_'+@b = 'C'''  SET @a = @a + 1 END 

Also, can you help me understand the proper usage of N’ and if its done correctly in this statement.

Thanks for your assistance.

  • 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. 2026-05-11T13:49:48+00:00Added an answer on May 11, 2026 at 1:49 pm

    The ‘sp_executesql’ stored proc expects a single string parameter @statement to execute.

    Your string is totally out of whack here….. you need to prefix any ‘fixed’ string parts with a N’……’ to make them Unicode strings, but this is definitely not properly the case here.

    I think you might want to try this:

    DECLARE @a INT  DECLARE @b VARCHAR(2)  SET @a = 1  DECLARE @statement NVARCHAR(500)  WHILE @a < 30 BEGIN     SET @b = CAST(@a AS VARCHAR(2))      SET @statement =          N'update source_temp set pmt_90_day = pmt_90_day + ' +               'convert(money, ''trans_total_' + @b + ''') ' +               'where convert(datetime, ''effective_date_' + @b + ''')' +              ' <= DATEADD(DAY, 90, ORSA_CHARGE_OFF_DATE) ' +              'and DRC_FLAG_' + @b + ' = ''C'''      exec sp_executesql @statement      SET @a = @a + 1 END 

    Does this work and do what you expect it to do??

    Explanation: the N’………’ delimits the whole string which contains the SQL statement. Any apostrophe inside that has to be duplicated (‘escaped’). I hope I understood your logic correctly.

    Marc

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

Sidebar

Ask A Question

Stats

  • Questions 116k
  • Answers 116k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer you can use this context: GenericApplicationContext mockContext = new GenericApplicationContext();… May 11, 2026 at 10:35 pm
  • Editorial Team
    Editorial Team added an answer You don't have .NET 3.5 SP1 installed on the server.… May 11, 2026 at 10:35 pm
  • Editorial Team
    Editorial Team added an answer $("#element_id").removeClass( "oldclass").addClass("newclass"); May 11, 2026 at 10:35 pm

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am currently running into a problem where an element is coming back from
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.