Friday, March 9, 2012

Question about data type sqlserver ?

I have two problem :

+ The first, This is table store all items in bookshop system

tblItems:
IDItem Identity(Auto number)
Namebook nvarchar2
Price nvarchar2
Chapters nvarchar2
Weight nvarchar2 (weight of book)
....
I design data type for Chapter,or Price,Weight is nvarchar2 ? <--I wrong ? (I want to refer to principle of design the database)

+ The second ,When i design Price is the int datatype ! The default value is 0 ( I don't want to have this value ,i want to it is a empty field )

I really sorry because i ask too much ! Because i am a new programming !

Any Help or Advice would like appreciately ! Thanks u !

In my opinion you should use these datatypes:
IDItem Identity(Auto number)
Namebook nvarchar2
Price decimal
Chapters integer
Weight decimal orinteger depending upon the unit of measure
I don't understand what you are saying about Price and the integerdatatype and having a default value of 0. Unless you do somethingspecial SQL Server will insert a NULL into that field if you haven'tspecified a value.

|||

Thank tomorton very much !
I really don't understand what happen to me !

But I design again table ,everything is good !

No comments:

Post a Comment