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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:53:31+00:00 2026-05-26T00:53:31+00:00

I have a string that looks like this: set @sqlstring = N’select @mindate =

  • 0

I have a string that looks like this:

set @sqlstring = N'select @mindate = min(time), @maxdate = max(time) from ' + @st_churn_active_table;

I print it and it looks like this:

select @mindate = min(time), @maxdate = max(time) from derp.derp_table

I run sp_executesql with parameter definitions like this:

execute sp_executesql @sqlstring, N'@maxdate date,@mindate date'

It errors like this:

The parameterized query '(@maxdate date,@mindate date)select @mindate = min(time), @maxda' expects the parameter '@maxdate', which was not supplied.

String becomes
‘(@maxdate date,@mindate date)select @mindate = min(time), @maxda’

The sql string is cut off, does anyone know why and how to fix this?

Thanks!

  • 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-26T00:53:31+00:00Added an answer on May 26, 2026 at 12:53 am

    First of all, sql server saw the whole string. It’s only the error message that truncates it. Notice the error got the name of the missing parameter right, even though the truncated sql string only had part of the name.

    Second, this isn’t going to work how you want it to. You can’t use output parameters that way with sp_executesql.

    But finally to the problem of why it’s throwing an error. I can’t be sure, but I suspect the problem here is that there is a type mismatch, and so it can’t use the parameter you gave it. I would hope that sql server would throw a better error message (complain about a type mismatch) in that situation, but I don’t have sql server handy to test with and I can’t think of any other reason for this to cause a problem.

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

Sidebar

Related Questions

I have a ViewModel that looks like this: public class CreateReviewViewModel { public string
I have a model that looks like this: public class Book { public string
I have query that looks like this declare @tmpTable Table(id int) insert into @tmpTable(id)
I have list of MyObject that looks like this: public class MyObject{ public int
I have created a class Person that looks like this: public class Person {
I have a JSON response that looks like this. I want to extract the
I am using MVVM Light. I have created a window that looks like this:
Hi I have a PersonName class that look like this: public class PersonName {
Today I've encountered one of the strangest things with MySQL I've seen. I have
I have such a funny question. I have the following architecture: For example, Manager

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.