Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread CAST integer as VARCHAR
Sun, Mar 21 2010 10:31 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

What is the smallest size VARCHAR I can use in a cast to ensure all digits of an integer fit? I'm currently using VARCHAR(16) but looking at MaxInt I should be OK with 10.

Roy Lambert
Mon, Mar 22 2010 12:19 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Roy,

<< What is the smallest size VARCHAR I can use in a cast to ensure all
digits of an integer fit? I'm currently using VARCHAR(16) but looking at
MaxInt I should be OK with 10. >>

For a 32-bit INTEGER, the max size would be Length('-2147483647'), or 11
digits (allowing for the sign).

--
Tim Young
Elevate Software
www.elevatesoft.com

Mon, Mar 22 2010 2:14 PMPermanent Link

Rita Tipton


"Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote in message
news:14418144-59F7-4715-A28F-5A89A8AA05EB@news.elevatesoft.com...
>
> For a 32-bit INTEGER, the max size would be Length('-2147483647'), or 11
> digits (allowing for the sign).
>

Bet u didnt calculate that on your fingers Wink
Rita

Tue, Mar 23 2010 12:36 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Rita,

<< Bet u didnt calculate that on your fingers Wink>>

Nah, but you do start to memorize a lot of the "magic" numbers by rote after
a bit of time doing database engine work.  They constantly come up in
various forms.

--
Tim Young
Elevate Software
www.elevatesoft.com

Tue, Mar 23 2010 5:15 PMPermanent Link

Steve Gill

Avatar


> Nah, but you do start to memorize a lot of the "magic" numbers by rote after
> a bit of time doing database engine work.  They constantly come up in
> various forms.

Do you get the same sequence of "magic numbers" that constantly come up in Lost? Smile

Steve
Thu, Mar 25 2010 2:45 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Steve,

<< Do you get the same sequence of "magic numbers" that constantly come up
in Lost? Smile>>

I wish - weren't they winning lottery numbers ? Smiley

--
Tim Young
Elevate Software
www.elevatesoft.com

Image