February 5, 2004 at 5:39 am
All standard dislcaimer apply. Table design by idiot who left long before I joined the company etc. etc.
Here's one I came across today. While trouble shooting an SP that had 'mysteriously' stopped working after an update to it at the start of the week, I noticed that a status column in a table it was updating was a varchar(2).
This was curious because it was storing two digit status code 00 to 99
The updated SP was trying to enter 157, without quotes
This ended up in the table as a *, so an implicit conversion is going on somewhere. The question is to what? * is 42 on my keyboard, so how is it getting to a *?
Here's a quick snippet to reproduce:
create table #Test_T
(Test varchar(2))
insert into #test_t (test) values('15') --works OK
insert into #test_t (test) values(15) --works OK
insert into #test_t (test) values('157') --errors
insert into #test_t (test) values(157) -- Goes in as *
select * from #test_t
Thoughts welcome
Dave Jackson
February 5, 2004 at 6:25 am
SQL will convert and truncate data where appropriate. When converting to varchar (implicitly or explicitly) and the value is too large SQL will insert and * instead.
See 'CAST and CONVERT' in BOL
Far away is close at hand in the images of elsewhere.
Anon.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply