May 28, 2010 at 11:00 am
Hello,
I am trying to insert a data into the database column having data type as smalldatetime with null value allowed.
the input data is 19010101 this is the data for date ,when i try to insert this data into a column having datatype as smalldatetime ,what I find is that the inserted value is not the date 19010101 but a null value,how can that be possible
May 28, 2010 at 11:21 am
Because you're trying to do it as an integer...
You need to convert put it in a string to convert it to smalldatetime. Try:
set MyField = convert(char(8), 19000101)
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
May 28, 2010 at 11:26 am
I have already converted this into string using data transformation column ie DT_STR
June 2, 2010 at 2:54 am
kanth.vishal (5/28/2010)
I have already converted this into string using data transformation column ie DT_STR
Strange, this works at my system:
declare @test smalldatetime;
select @test = CONVERT(char(8),19010101);
print @test
Is it only for the date 19010101 or for all the dates that you try to insert?
Is everything mapped correctly in the Destination?
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply