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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T12:39:11+00:00 2026-05-19T12:39:11+00:00

Compare these two statements select stuff(convert(varchar(max),replicate(‘a’, 10000)),8001,1,’b’) select stuff(convert(varchar(max),replicate(‘a’, 10000)),8000,1,’b’) Output aaaaaaaaaaaaaaaaaaaaaaaa… NULL Books

  • 0

Compare these two statements

select stuff(convert(varchar(max),replicate('a', 10000)),8001,1,'b')
select stuff(convert(varchar(max),replicate('a', 10000)),8000,1,'b')

Output

aaaaaaaaaaaaaaaaaaaaaaaa...
NULL

Books Online says start can be of type bigint. Why such a large range if it won’t even work for 8001?

If the behaviour is different between 2005, 2008, 2008 R2 and Denali, then I would like to know the actual behaviour of each version.

  • 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-19T12:39:11+00:00Added an answer on May 19, 2026 at 12:39 pm

    REPLICATE ('a', 10000) will produce a 8000 characters string:

    If string_expression is not of type
    varchar(max) or nvarchar(max),
    REPLICATE truncates the return value
    at 8,000 bytes. To return values
    greater than 8,000 bytes,
    string_expression must be explicitly
    cast to the appropriate large-value
    data type.

    Try REPLICATE (cast('a' as varchar(max)), 10000).

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

Sidebar

Related Questions

I'm trying to SELECT two values in one statement instead of two statements. The
Please compare these two codes. I can't understand why former one didn't work while
I have two dates, formated like "Y-m-d H:i:s". I need to compare these two
Are there any tools to effectively compare two XML schema's? I have seen some
Is there in Ruby some functionality/syntax to compare two floats with delta? Something similar
Is there any built-in, add-in solution for visual studio to compare two files and
I need to compare 2 strings as equal such as these: Lubeck == Lübeck
How to compare two lists in python? date = Thu Sep 16 13:14:15 CDT
We have two lists, let's say students and their scores. I want to compare
I am trying to compare two .caf files on the basis of some parameter,

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.