You are here: Re: the datatype « MsSQL Server « IT news, forums, messages
Re: the datatype

Posted by Tony Rogerson on 05/17/06 16:55

If you are just storing the description, eg...

mm
seconds
n-page

then I'd hold them using nvarchar and size it according to the maxium length
you expect, if its just the above then nvarchar(7).

If you are talking about the units themselves then i'd go down this
route....

create table unit_type (
id int not null identity constraint sk_unit_type unique clustered,
name nvarchar(7) not null constraint pk_unit_type primary key
nonclustered
)

create table measurement (
unit_type_id int not null references unit_type( id ),
unit decimal( 10, 5 ) not null
)

Hope that helps.

Tony.

--
Tony Rogerson
SQL Server MVP
http://sqlblogcasts.com/blogs/tonyrogerson - technical commentary from a SQL
Server Consultant
http://sqlserverfaq.com - free video tutorials


"John Kevien" <kevien-2002@163.com> wrote in message
news:mJBag.1$RV2.122@news.uswest.net...
>
> hello !
>
> I got some problems here. I have an attribute that determines the unit
> of something,e.g. the size of using "mm" , the length of using "seconds"
> and something others may using "n-page", so ,which data type should I
> use. the "nvarchar" or others?
>
>
> thank you very much!
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация