varchar cutting at 257th
From: Mawron (mawronthefounder_at_SPAMBLOCKyahoo.it)
Date: 08/09/04
- Next message: Keith Kratochvil: "Re: varchar cutting at 257th"
- Previous message: Enric: "User dbo"
- Next in thread: Keith Kratochvil: "Re: varchar cutting at 257th"
- Reply: Keith Kratochvil: "Re: varchar cutting at 257th"
- Reply: Wayne Snyder: "Re: varchar cutting at 257th"
- Reply: Andrew John: "Re: varchar cutting at 257th"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 09 Aug 2004 11:25:27 GMT
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 . *
* . . . +
- Next message: Keith Kratochvil: "Re: varchar cutting at 257th"
- Previous message: Enric: "User dbo"
- Next in thread: Keith Kratochvil: "Re: varchar cutting at 257th"
- Reply: Keith Kratochvil: "Re: varchar cutting at 257th"
- Reply: Wayne Snyder: "Re: varchar cutting at 257th"
- Reply: Andrew John: "Re: varchar cutting at 257th"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|