December 2, 2009 at 11:09 am
I setup a simple import/export task to pull one table into another. The data destination has a simple auto increment key field setup along with three data fields from the the source table. "Enable identity insert" is checked and yet I get the following error: 'Cannot insert the value NULL into column'
Why and how do I get this going?
December 2, 2009 at 11:44 am
[font="Comic Sans MS"]
1) For my better understanding are you using the OLE DB/SQLServer destination with "Keep identity" checked?
2) This might sound very obvious - but did you check if any of the other non-identity column is set to be NOT NULL and the code is trying to insert NULL value from source?
[/font]
[font="Comic Sans MS"]--
Sabya[/font]
December 2, 2009 at 12:09 pm
I suspect that the error message is telling you the truth - setting IDENTITY INSERT does not mean that you can put NULLs into a PK field.
You need to double check your source data.
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
July 15, 2010 at 1:45 pm
HI - I seem to have similar problem - when importing data from FLAT txt file to table in SQL Server via .dtsx file empty records in txt are not populated to SSMS table as NULL but simply as emply cells without any value.
How can I set SSIS package to import such cells as NULL rather then empty cell?
Thanks for any help!
Ev.
July 16, 2010 at 2:35 am
Isn't an empty cell without a value equal to NULL?
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
July 16, 2010 at 2:43 am
nope.
It is usefull having NULL values in the columns rather then empty cells in cases where for example coalesce or function isNull ([attribute],[attribute]) is used.
empty cell just simply doesnt create desired results.
July 16, 2010 at 2:59 am
How do you define empty cells? As an empty string: "" ?
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
July 16, 2010 at 3:53 am
yes
July 16, 2010 at 4:51 am
Then add a derived column in your data flow that converts the emptry strings to null values.
You need an expression that resembles this:
[myColumn] == "" ? NULL(DT_WSTR, 10) : [myColumn]
This expression is for a nvarchar(10) column.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
July 16, 2010 at 8:53 pm
evelyn.bidenkova (7/15/2010)
HI - I seem to have similar problem - when importing data from FLAT txt file to table in SQL Server via .dtsx file empty records in txt are not populated to SSMS table as NULL but simply as emply cells without any value.How can I set SSIS package to import such cells as NULL rather then empty cell?
Thanks for any help!
Ev.
inside DFT, select check box "retain null values from the sources as null values in the data flow" for flat file edit propreties
also, pls see attached image for source and output result too, i hope thats what you are looking for....
July 19, 2010 at 5:31 am
To: PaVeRa22
PaVeRa22 you are star! It worked - how could I miss that small check box? 😉
Many thanks!
Eve
:w00t:
July 19, 2010 at 11:24 pm
evelyn.bidenkova (7/19/2010)
To: PaVeRa22PaVeRa22 you are star! It worked - how could I miss that small check box? 😉
Many thanks!
Eve
:w00t:
Sounds good, glad to hear that issue was resolved with that flag.
Cheers
April 28, 2017 at 1:13 pm
Can you please inform what do I do if the destination table field is Amount ?
[myColumn] == "" ? NULL(DT_WSTR, 10) : [myColumn]
can you please provide above expression for money or numeric field ?
April 28, 2017 at 1:31 pm
bhavesh55 - Friday, April 28, 2017 1:13 PMCan you please inform what do I do if the destination table field is Amount ?
[myColumn] == "" ? NULL(DT_WSTR, 10) : [myColumn]
can you please provide above expression for money or numeric field ?
Hello and welcome to the forum.
Please note that the thread you have responded to is 7 years old. I therefore recommend that you create a brand new topic instead & describe your question there in detail.
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
April 28, 2017 at 3:13 pm
Hi Phil,
I posted new question but didn't receive any response. My question is
SSIS Derived column expression:
https://ask.sqlservercentral.com/questions/142807/ssis-derived-column-expression-1.html#answer-142820
I would appreciate your time and help in advance.
Viewing 15 posts - 1 through 14 (of 14 total)
You must be logged in to reply to this topic. Login to reply