SQL SERVER – Puzzle – Brain Teaser – Changing Data Type is Changing the Default Value

Today, we will see a very interesting puzzle about data types and default values.

SQL SERVER - Puzzle - Brain Teaser - Changing Data Type is Changing the Default Value datatypespuzzle-800x199

There are three important properties for any column –

  • Datatype
  • Default value
  • Null-ability

A column can be NULL or NOT NULL depending on the business requirements. Along with the null ability, often columns can have default values. Today we will see a puzzle where we will talk about data types and their default values.


Let us assume that there is a column with original datatype A and it has a default value of B. Due to some business reason, we changed the data type from original datatype A to new data type C. When the datatype got changed from A to C, even though we did not change the datatype, it was automatically changed from original default C to new default D. The value of default value D is completely different from the earlier default value of B.

You need to answer-

1 The original datatype A and default value B
2 The new datatype C and new default value D

I guess that’s it. If you think, the answer is very simple. Let us see if you can get it right or not.

Please post your answers in the comment sections. I will keep all the comments hidden till next week Thursday. This way everyone gets a chance to participate in this puzzle.

Reference: Pinal Dave (https://blog.sqlauthority.com)

SQL Column, SQL Datatype, SQL NULL, SQL Server
Previous Post
SQL SERVER – Puzzle – Adding Two Dates Resulting Strange Results
Next Post
SQL SERVER – Puzzle – Why Does UNION ALL Work but UNION Produces Error?

Related Posts

18 Comments. Leave new

Leave a ReplyCancel reply

Exit mobile version