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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 How to Insert Null Values to date fields (Urgent)

Author  Topic 

mahigupt
Starting Member

1 Post

Posted - 2008-12-22 : 07:13:04
Hi all,

I have taken a date field in a table in sql server and i have checked allow nulls to that field but when iam trying to insert null value to the date field it is throwing an exception so can any one tell how to null values to the date field.

awaiting for the reply.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-12-22 : 07:52:35
Can you post the exception text?



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

bklr
Master Smack Fu Yak Hacker

1693 Posts

Posted - 2008-12-30 : 23:42:43
u have to alter u column to nullable
r other wise send an empty string in to date column

alter table tablename alter column datefield datatype null

or
create table temp(date datetime not null)
alter table temp alter column date datetime null
insert into temp select null
select * from temp
drop table temp
Go to Top of Page
   

- Advertisement -