Re: varchar cutting at 257th

From: Wayne Snyder (wayne.nospam.snyder_at_mariner-usa.com)
Date: 08/09/04


Date: Mon, 9 Aug 2004 08:21:23 -0400

To add to Keiths response... The data is being correctly stored in the
database. Query Analyzer was truncating the data from the display.

-- 
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Mawron" <mawronthefounder@SPAMBLOCKyahoo.it> wrote in message
news:HaJRc.36605$OH4.1039581@twister1.libero.it...
> Hi to all.
> Please take a look at this simple code and the inline comments:
>
> -- start here --
> declare @t varchar(2000)
>
> set @t='12345678901234567890' -- 20 chars
> set @t=@t+@t -- @t now contains 40chars
> set @t=@t+@t -- 80
> set @t=@t+@t -- 160
> set @t=@t+@t -- 320
> set @t=@t+@t -- 640 chars
>
> -- this line print all the 640 characters
> print @t
>
> -- the table has a column declared as varchar(2000)
> insert into table
> (columnName)
> values
> (@t)
>
> -- the query should return all the 640 chars, but...
> --  only the first 257 chars are memorized! :(
> select *
> from table
> -- stop here --
>
> The code comes from a stored procedure I wrote to test my real db table.
> Why only the first 257 chars are inserted? I don't understand... :(
>
> -- 
>     .   .     *      +
> .    .   Mawron   .      *
>     *     .   .       .  +


Relevant Pages

  • Re: SQL DB Design Tool
    ... "Wayne Snyder" wrote in message ... > Wayne Snyder, MCDBA, SQL Server MVP ... >> Mark Broadbent ...
    (microsoft.public.sqlserver.server)
  • Re: Time range matching
    ... > datetime with a time range that spans multiple days... ... > Wayne Snyder, MCDBA, SQL Server MVP ... > community of SQL Server professionals. ...
    (microsoft.public.sqlserver.server)
  • Re: Add new column to a replicated table..
    ... "Wayne Snyder" wrote in message ... > Sp adds the column to the table, and fixes replication... ... > Wayne Snyder, MCDBA, SQL Server MVP ... > community of SQL Server professionals. ...
    (microsoft.public.sqlserver.programming)
  • Re: How to know the table size in sql database and how to know whi
    ... each table during the iteration that happens within the stored procedure. ... > Wayne Snyder, MCDBA, SQL Server MVP ... > community of SQL Server professionals. ...
    (microsoft.public.sqlserver.server)
  • Re: How to learn .Net
    ... > Wayne Snyder, MCDBA, SQL Server MVP ... > Mariner, Charlotte, NC ... >> I read everywhere at the moment that SQL Server professionals need to ...
    (microsoft.public.sqlserver.server)