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
 Creating tables

Author  Topic 

JJins
Yak Posting Veteran

81 Posts

Posted - 2010-11-10 : 11:01:09
Can anyone define what the different Datatypes are....example bit= true or fals, timestamp = date and time of present day. Then I also a question regarding primary and seconday keys.


when building the tables you should not allow nulls for the primary key......(yes/NO?) Should you for foriegn keys?


what are the results or future problems you will find yourself in if you do or dont allow nulls?

Thanks as always!

best,
GG

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-11-10 : 11:08:25
primary key doesnt allow null values
But you can have Nulls in column having foreign key constraint

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2010-11-10 : 12:13:17
quote:
Originally posted by JJins

timestamp = date and time of present day.
Be careful with TIMESTAMP. This is a special datatype/column and is NOT a date but a VARBIANRY data type. And I believe that TIMESTAMP is deprecated and the new nomenclature is ROWVERSION.

From Books Online:
quote:
(Rowversion) Is a data type that exposes automatically generated, unique binary numbers within a database. rowversion is generally used as a mechanism for version-stamping table rows. The storage size is 8 bytes. The rowversion data type is just an incrementing number and does not preserve a date or a time.
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2010-11-10 : 12:24:03
timestamp is confusing to cross paltform people

in DB2 all it means its datetime...LIKE IT SHOULD FOR ALL OTHER PLATFORMS


Duh Bill...you stole enough...but not enough

wait is this thing on?




Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2010-11-10 : 12:36:27
quote:
Originally posted by JJins

Can anyone define what the different Datatypes are


See here
Go to Top of Page
   

- Advertisement -