Link to home
Create AccountLog in
Avatar of crudmop
crudmop

asked on

Returning varchar(8000) only allowing a return of 4000 characters

Can someone explain why the following proc is only returning 4000 characters?  QA is set to 8192, btw.  If I run a len on the retval it returns 4000 characters when there are about 5000 worth of the columns I am returning.

declare @retval varchar(8000)
   select @retval = coalesce(@retval + ',', '') + '[' + column_name + ']' from information_schema.columns where table_name = @table_name and column_name not in (@skipcols) order by column_name
   select @retval
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of crudmop
crudmop

ASKER

doh doh doh.

Ya know I stared at this wondering what the hell was up.  You win the "let me make fun of you by pointing out the obvious" award.

Thanks much :)
<Author Comments>
doh doh doh.

Ya know I stared at this wondering what the hell was up. You win the "let me make fun of you by pointing out the obvious" award.
</Author Comments>

sorry, but that is not obvious "per se", as it's the typical case of implicit data type conversion, which are difficult to "see". as from some months/years of experience you remember things like those, and first search in that directly.

glad I could help to "un"-doe this :)

Cheers