SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


VarChar(max)?!?


VarChar(max)?!?

Author
Message
Philip Barry
Philip Barry
SSCommitted
SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)

Group: General Forum Members
Points: 1620 Visits: 646
Glad to see a clearer explanation from Simon, had a better understanding after that.

Regards,

Phil
GSquared
GSquared
SSC Guru
SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)

Group: General Forum Members
Points: 54399 Visits: 9730
vlad (8/11/2008)
this makes varchar(max) a special type ... necessitating special handling aka "workaround" for a bug, maybe ??


Nope. Implicit conversion can be a problem on just about any data type. Elimination of implicit conversion would be the only way to handle that, and implicit conversion has too many good uses to get rid of it because of people who don't learn how to handle it correctly.

- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread

"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
vlad-548036
vlad-548036
SSCrazy
SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)

Group: General Forum Members
Points: 2948 Visits: 273
Nope. Implicit conversion can be a problem on just about any data type. Elimination of implicit conversion would be the only way to handle that, and implicit conversion has too many good uses to get rid of it because of people who don't learn how to handle it correctly.

- GSquared


Despite the fact that implicit conversion maybe good or bad, varchar(max) is a not the same type as varchar(N), 0<=N<=8000 .. something to keep in mind!
bhusank_neuronimbus
bhusank_neuronimbus
Valued Member
Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)

Group: General Forum Members
Points: 51 Visits: 12
Hi Simon,
Thank for the explanation of the question.
GSquared
GSquared
SSC Guru
SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)

Group: General Forum Members
Points: 54399 Visits: 9730
vlad (8/12/2008)
Nope. Implicit conversion can be a problem on just about any data type. Elimination of implicit conversion would be the only way to handle that, and implicit conversion has too many good uses to get rid of it because of people who don't learn how to handle it correctly.

- GSquared


Despite the fact that implicit conversion maybe good or bad, varchar(max) is a not the same type as varchar(N), 0<=N<=8000 .. something to keep in mind!


Exactly.

- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread

"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
Linson.Daniel
Linson.Daniel
SSC-Addicted
SSC-Addicted (415 reputation)SSC-Addicted (415 reputation)SSC-Addicted (415 reputation)SSC-Addicted (415 reputation)SSC-Addicted (415 reputation)SSC-Addicted (415 reputation)SSC-Addicted (415 reputation)SSC-Addicted (415 reputation)

Group: General Forum Members
Points: 415 Visits: 391
A real good explanation by Simon....Im quiet clear on this one..Thanks SimonSmile
Bhuvnesh
Bhuvnesh
SSChampion
SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)

Group: General Forum Members
Points: 12492 Visits: 4077
--Step 1
Declare @Str VarChar(max);
Set @Str=Replicate(cast('*'as varchar(MAX)) ,10000)
Print Len(@Str);

--Step 2
Declare @Str VarChar(max);
Set @Str=Replicate('*' ,10000)
Print Len(@Str);


----

i m hardly got the difference between step 1 and step 2 ..please explain both ????

-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done;-)
SQLRNNR
SQLRNNR
SSC Guru
SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)

Group: General Forum Members
Points: 63459 Visits: 18570
nice to have a clear explanation.

Good question



Jason AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server, MVP


SQL RNNR

Posting Performance Based Questions - Gail Shaw

Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search