Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 numeric or int?

Author  Topic 

crugerenator
Posting Yak Master

126 Posts

Posted - 2008-11-24 : 16:18:25
I'm creating a stored procedure and can't get a clear answer on what data types to use a parameter. In the table, the field has a type of numeric. Should I use numeric in the proc or do I use int?

Example of table:
Organization:
organizationID(PK, numeric(18,0), not null)


My proc is an update of the Organization table, so I'm passing in orgID in the where clause.

Do I set the parameter in the proc like this?
@orgID int

OR

@orgID numeric


Thanks in advance

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-11-24 : 16:55:13
BIGINT. More digits and less storage space.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2008-11-24 : 19:21:54
Since your table stored the OrgID as numeric(18,0), then your paramter would also be numeric(18,0). However, if you have the change to change it, then I'd follow Peso's suggestion and make it a BIGINT (assuming you need numbers that big).
Go to Top of Page
   

- Advertisement -