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.
| Author |
Topic |
|
nishu81
Starting Member
11 Posts |
Posted - 2009-11-26 : 08:06:02
|
| HiI am facing two problem while working with Default constraintMy table "shippers" includes 3 columns: "Shippers ID(identity colmn) ","shippersName","ShippedDate"Now I have Provided default constraints on "Shippersname" with Default value ashok and for "shippeddate" as getdate()Note that all the column are not nullThis constraints is working fine when I am using a query likeinsert into shippers (shippersName) values ('nishu')or insert into shippers (shippeddate) values ('01/01/2008')In first case since i have not provided shippeddate so it is taking my defualt value getdate() and in second I have not provided shippersName so it is taking my default value <ashok>My Problem is when I am using a query likeinsert into shippers (shippersName, shippeddate) values ('','')Then in above case also I am not providing any value so it should dake my default value but what is happening is shippeddate is taking default value of SQL server 1900-01-01 00:00:00.000 and shippersName is blank.It is not even NULL I want to ask 2 questions1)when i am using '' for varchar .Is it working as some value?isn't equal to null2)why when I am using '' as for dattime it is not taking my default date and rather taking SQL default date |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|