Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

SQL Character type for Shipping height, width, weight?

LEGEND ,
Jan 07, 2008 Jan 07, 2008

Copy link to clipboard

Copied

I'm wondering what the best Character type to use for setting up tables
in SQL. I have Shipping height, Width, Depth and Weight LBS.

Thanks
TOPICS
Server side applications

Views

748
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 08, 2008 Jan 08, 2008

Copy link to clipboard

Copied


Anyone with advice?

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 08, 2008 Jan 08, 2008

Copy link to clipboard

Copied

In other words, if the height is 53.75 inches, I don't need the inches
in it but I would need the 53.75. So what would be the best character
type, number, int, real, tinyint...?

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 08, 2008 Jan 08, 2008

Copy link to clipboard

Copied

.oO(Art)

>In other words, if the height is 53.75 inches, I don't need the inches
>in it but I would need the 53.75. So what would be the best character
>type, number, int, real, tinyint...?

Depends on the precision you need. Money values for example should
always be stored as fixed point numbers or integers to avoid rounding
errors, but in your case I think a floating point type would work OK.

Micha

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 08, 2008 Jan 08, 2008

Copy link to clipboard

Copied

Art wrote:
> I'm wondering what the best Character type to use for setting up tables
> in SQL. I have Shipping height, Width, Depth and Weight LBS.

You don't say which database you're using, but all the values you refer
to are numbers. Depending on how you want to enter the numbers, use
either an integer type or float (double). Since you refer to pounds, it
sounds as though you are using Imperial measures, so it will be
difficult to use decimals unless you want to use 1.5 for 1 foot 6 inches
or 1 pound 8 ounces. The way round this is to store your measurements in
the smallest units: inches and ounces. Use server-side code to convert
the measurements in the background.

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 08, 2008 Jan 08, 2008

Copy link to clipboard

Copied

David Powers wrote:
> Art wrote:
>> I'm wondering what the best Character type to use for setting up
>> tables in SQL. I have Shipping height, Width, Depth and Weight LBS.
>
> You don't say which database you're using, but all the values you refer
> to are numbers. Depending on how you want to enter the numbers, use
> either an integer type or float (double). Since you refer to pounds, it
> sounds as though you are using Imperial measures, so it will be
> difficult to use decimals unless you want to use 1.5 for 1 foot 6 inches
> or 1 pound 8 ounces. The way round this is to store your measurements in
> the smallest units: inches and ounces. Use server-side code to convert
> the measurements in the background.
>

Microsoft SQL 2000

Here is an example of typical data
ID1 ID Origin Length Width Depth LBS
1 G-2003 CO 10.5 8.25 1.5 0.8

ID1 ID Origin Length Width Depth LBS
18 G-2119 CO 5.91 5.91 18.5 2.65

I was thinking of using decimal with a precision of 5 and scale of 2.
Would this be the most efficient? In design view, there is also the
"length" but I'm not sure what, exactly that is needed for in decimal.

It sounds like integer or float are what is being recommended. With the
number above, does that still sound appropriate?

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 08, 2008 Jan 08, 2008

Copy link to clipboard

Copied

Art wrote:
> Microsoft SQL 2000

I'm not familiar with MS SQL Server, so I think you are likely to get
better advice from someone who is.

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 08, 2008 Jan 08, 2008

Copy link to clipboard

Copied

David Powers wrote:
> Art wrote:
>> Microsoft SQL 2000
>
> I'm not familiar with MS SQL Server, so I think you are likely to get
> better advice from someone who is.
>
David, you wouldn't want to take an "educated guess" at it? If you
don't, I'll be forced to take a guess myself;)

Anyone else familiar with MS SQL 2000? Or, 2005 for that matter?

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 08, 2008 Jan 08, 2008

Copy link to clipboard

Copied

LATEST
Anyone know what the "length" is for in SQL enterprice manager (under
decimal character type)? I understand Precision and Scale but not
"length" up in the area where you select the character type. Should this
be 5 if my precision is 5?

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines