TSQL - largest integer type bigint?

This is mostly a TSQL question but C# enters in as well (down at the bottom).

What is the biggest TSQL data type for positive integer values?  Is it bigint?

If I am getting an overflow, what can be done?

I read somewhere that any calculations are done with both numbers as integers and the result is only casted as a bigint, or something or other.  I understand that to mean:

integer * integer = bigint

because you can't do this:

bigint * bigint = bigint             --(overflow??)

I think it is this line in the TSQL that is causing the problem:

(excerpted from the stored proc):

 ...

...
      
      @LookupListKey bigint,

...

...


SET @LookupListKey = (SELECT MAX(LookupListKey) * MAX(LookupListKey) FROM UNAdmin.SystemLocations)


I've been thinking of storing the result as a string, thinking that a string representation could represent an integer value far larger than int or bigint.  

Suggestions for storing very large numbers that won't fit in a bigint?

Side question:  What C# data type can hold the largest positive integer value?  What is the C# data type compatible with bigint?
LVL 5
Tom KnowltonWeb developerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AndyAinscowFreelance programmer / ConsultantCommented:
DECIMAL I think stores more than a bigint.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Tom KnowltonWeb developerAuthor Commented:
Huh....okay.  : )
0
Kyle AbrahamsSenior .Net DeveloperCommented:
BigInt:  -9.2 x 10^18 to 9.2 x 10^18
Decimal(38,0):  -10^38 to 10^38
0
Tom KnowltonWeb developerAuthor Commented:
Thank you both.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.