Discussion:
@insertString being truncated
(too old to reply)
Bob
2012-07-06 05:17:29 UTC
Permalink
I am starting with a

Declare @insertString varchar(8000)

Then I'm creating a cursor and looping through records while setting

@insertString = @insertString + 'the newest record from the cursor'

This works fine but for some reason the maximum SIZE for the @insertString stops at 4000

Why is this?

Again, it works fine as long as the len is 4000 or less.

The table field is clearly a varchar(8000)

Anybody got any ideas?

Bob Sweeney
Erland Sommarskog
2012-07-06 08:56:48 UTC
Permalink
Post by Bob
I am starting with a
Then I'm creating a cursor and looping through records while setting
@insertString = @insertString + 'the newest record from the cursor'
This works fine but for some reason the maximum SIZE for the
@insertString stops at 4000
Why is this?
Again, it works fine as long as the len is 4000 or less.
The table field is clearly a varchar(8000)
Anybody got any ideas?
Without seeing your code?
--
Erland Sommarskog, SQL Server MVP, ***@sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
Bob
2012-07-06 16:18:06 UTC
Permalink
Post by Bob
I am starting with a
Then I'm creating a cursor and looping through records while setting
@insertString = @insertString + 'the newest record from the cursor'
Why is this?
Again, it works fine as long as the len is 4000 or less.
The table field is clearly a varchar(8000)
Anybody got any ideas?
Bob Sweeney
Erland, if you don't know the answer to my question then kindly shut the fuck up.
Gene Wirchenko
2012-07-06 17:23:06 UTC
Permalink
Post by Bob
Post by Bob
I am starting with a
Then I'm creating a cursor and looping through records while setting
@insertString = @insertString + 'the newest record from the cursor'
Why is this?
Again, it works fine as long as the len is 4000 or less.
The table field is clearly a varchar(8000)
Anybody got any ideas?
Yes, see below.
Post by Bob
Post by Bob
Bob Sweeney
Erland, if you don't know the answer to my question then kindly shut the fuck up.
You should improve your manners.

I was going to post some data that might help, but considering
how you treated Erland, no. Erland might well be the most helpful
person on this newsgroup. I would not want to see him leave because
of a jerk (you).

Sincerely,

Gene Wirchenko


Sincerely,

Gene Wirchenko
Jeroen Mostert
2012-07-06 18:59:58 UTC
Permalink
Post by Bob
Post by Bob
I am starting with a
Then I'm creating a cursor and looping through records while setting
@insertString = @insertString + 'the newest record from the cursor'
Why is this?
Again, it works fine as long as the len is 4000 or less.
The table field is clearly a varchar(8000)
Anybody got any ideas?
Bob Sweeney
Erland, if you don't know the answer to my question then kindly shut the fuck up.
May your problems multiply, and last for all your life.
--
J.
Erland Sommarskog
2012-07-06 21:44:40 UTC
Permalink
Post by Bob
Post by Bob
I am starting with a
Then I'm creating a cursor and looping through records while setting
@insertString = @insertString + 'the newest record from the cursor'
This works fine but for some reason the maximum SIZE for the
@insertString stops at 4000
Why is this?
Again, it works fine as long as the len is 4000 or less.
The table field is clearly a varchar(8000)
Anybody got any ideas?
Erland, if you don't know the answer to my question then kindly shut the fuck up.
That's correct. I don't know the answer to your question. But if you had
given me sufficient information, for instance the code you are having
problem, I might have been able to help.

Sure, I could produce a number of guesses, but having answered a couple
of questions on newsgroups and forums, my experience is that the root of
the problem lies in something the poster did not tell me.
--
Erland Sommarskog, SQL Server MVP, ***@sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
Bob
2012-07-06 19:13:58 UTC
Permalink
Post by Bob
I am starting with a
Then I'm creating a cursor and looping through records while setting
@insertString = @insertString + 'the newest record from the cursor'
Why is this?
Again, it works fine as long as the len is 4000 or less.
The table field is clearly a varchar(8000)
Anybody got any ideas?
Bob Sweeney
Gene, get lost. Join erlander.
Gene Wirchenko
2012-07-06 20:12:26 UTC
Permalink
Post by Bob
Post by Bob
I am starting with a
Then I'm creating a cursor and looping through records while setting
@insertString = @insertString + 'the newest record from the cursor'
Why is this?
Again, it works fine as long as the len is 4000 or less.
The table field is clearly a varchar(8000)
Anybody got any ideas?
Bob Sweeney
Gene, get lost. Join erlander.
Erland is here, and so am I.

Ah, your language is a little politer there. Keep working on it,
and you may be fit company yet.

When you finish digging that hole for yourself, what are you
going to do with it? I suggest that you might try filling it in. An
apology would be nice.

Sincerely,

Gene Wirchenko
phil hunt
2012-07-06 20:39:35 UTC
Permalink
I you are looking at the data from the studio, please know that there is
limit on the size of field being shown. Run a query to detremine the actual
length instead.
Post by Bob
I am starting with a
Then I'm creating a cursor and looping through records while setting
@insertString = @insertString + 'the newest record from the cursor'
Why is this?
Again, it works fine as long as the len is 4000 or less.
The table field is clearly a varchar(8000)
Anybody got any ideas?
Bob Sweeney
Loading...