x
login about faq Site discussion (meta-askssc)

Null Data Type

Could anyone explain me with suitable example , What is the difference between Null Data Types and Not Null Data Type ?

Whenever we create any user defined data type it will ask whether you want to create null or not null data type. So my Concern here what it will create difference in both case.

With Regards, Shalabh Saxena

more ▼

asked May 20 '12 at 07:29 AM in Default

shalabh2108 gravatar image

shalabh2108
40 1 2 3

(comments are locked)
10|1200 characters needed characters left

2 answers: sort voted first

The difference is just whether the type can hold a null value. If not specified, NULL is the default.

more ▼

answered May 21 '12 at 12:32 PM

Kev Riley gravatar image

Kev Riley ♦♦
46k 38 43 69

(comments are locked)
10|1200 characters needed characters left

There is no NULL data type. Each of the data types (with a couple of exceptions) can be NULL. You can require a value, which means that you define that column for a given data type within a table as NOT NULL. Or, you can specify that a given column in the table allows NULL values, by setting it's definition using NULL.

You just have to remember that NULL is just that, NULL. It doesn't have any meaning. It's not the same as an empty string, or zero, or an empty set, or even unknown. It's simply not there, NULL. Also a NULL value can't be compared to another value, even another NULL value. So you can't use = < > or any other comparison operator. Instead you have to use commands that take into account NULL logic such as ISNULL, IS NULL, IS NOT NULL.

more ▼

answered May 21 '12 at 01:19 PM

Grant Fritchey gravatar image

Grant Fritchey ♦♦
61.9k 12 19 66

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments



Facebook logo Follow Ask SSC on Facebook
Find Ask SSC on Google+
linkedin logo Find us on LinkedIn

Topics:

x1601
x598

asked: May 20 '12 at 07:29 AM

Seen: 307 times

Last Updated: May 21 '12 at 01:19 PM

Copyright © 2002-2012 Simple Talk Publishing. All Rights Reserved. If you have any queries, please contact the site administrators.
Ask SQL Server Central is a community service provided by Red Gate.