I have an sp that update my table from my form. When I try the sp is running to update and leave the datetime field empty, it put the default datetime as "1900-01-01 00:00:00.000" How can I set it to be null?
I have checked the values my form send the filldate is empty.
I have example of sp here:
ALTER PROCEDURE [dbo].[DBK_spDataUpdate]
@FirstName AS NVARCHAR(250)= NULL
@FillDate AS DATETIME = NULL
@DataID AS BIGINT
SET NOCOUNT ON;
UPDATE dbo.DBK_tbData
SET FirstName = @FirstName,
FillDate = @FillDate
WHERE DataID = @DataID
datetimevalue. Instead of passing an empty string, pass theNULLliteral instead.NULLaren't the same thing. If you pass an Empty String ('') to a datetime variable, it will default to'1900-01-01'. Are you passing an empty string, or aNULL?