SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Extracting VarBinary(MAX) column to Flat File - Facing Issue.


Extracting VarBinary(MAX) column to Flat File - Facing Issue.

Author
Message
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)

Group: General Forum Members
Points: 88584 Visits: 41130
windows_mss (7/30/2014)
Thanks Guys for your guidance...

I have overcomes this problem using XQuery functionality.


Any chance of you posting the code/package you ended up with?

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
nishav2
nishav2
SSC-Enthusiastic
SSC-Enthusiastic (163 reputation)SSC-Enthusiastic (163 reputation)SSC-Enthusiastic (163 reputation)SSC-Enthusiastic (163 reputation)SSC-Enthusiastic (163 reputation)SSC-Enthusiastic (163 reputation)SSC-Enthusiastic (163 reputation)SSC-Enthusiastic (163 reputation)

Group: General Forum Members
Points: 163 Visits: 103
Hi,

I am facing similar kind of problem.I have an SSIS package which has a flat file source and an oledb destination.
I am transferring flat file content to a table.This SQL table has a column named 'SSN' defined as VARBINARY(300).Because i need to store the encrypted value in it and not the actual value.
I have created an 'Instead of Insert' Trigger on that table.So this trigger will encrypt and store the value in SSN field.

But in text file this SSN column comes as Varchar. How to type cast this varchar to varbinary in SSIS package.
I tried to convert the datatype by using Derived column,Data conversion etc.,But it did not work out.

Can anyone help me on this!

Thanks
Nisha V Krishnan
rxm119528
rxm119528
Mr or Mrs. 500
Mr or Mrs. 500 (512 reputation)Mr or Mrs. 500 (512 reputation)Mr or Mrs. 500 (512 reputation)Mr or Mrs. 500 (512 reputation)Mr or Mrs. 500 (512 reputation)Mr or Mrs. 500 (512 reputation)Mr or Mrs. 500 (512 reputation)Mr or Mrs. 500 (512 reputation)

Group: General Forum Members
Points: 512 Visits: 804
nishav2 (8/22/2014)
Hi,

I am facing similar kind of problem.I have an SSIS package which has a flat file source and an oledb destination.
I am transferring flat file content to a table.This SQL table has a column named 'SSN' defined as VARBINARY(300).Because i need to store the encrypted value in it and not the actual value.
I have created an 'Instead of Insert' Trigger on that table.So this trigger will encrypt and store the value in SSN field.

But in text file this SSN column comes as Varchar. How to type cast this varchar to varbinary in SSIS package.
I tried to convert the datatype by using Derived column,Data conversion etc.,But it did not work out.

Can anyone help me on this!

Thanks
Nisha V Krishnan


As a work around i tried it in two steps
1) in the first DFT i got the data from the flat file to a staging table
2) then in the second DFT i used the SQL Command to cast the column to binary.

As of now this seems to be working.

thanks
nishav2
nishav2
SSC-Enthusiastic
SSC-Enthusiastic (163 reputation)SSC-Enthusiastic (163 reputation)SSC-Enthusiastic (163 reputation)SSC-Enthusiastic (163 reputation)SSC-Enthusiastic (163 reputation)SSC-Enthusiastic (163 reputation)SSC-Enthusiastic (163 reputation)SSC-Enthusiastic (163 reputation)

Group: General Forum Members
Points: 163 Visits: 103
Thanks for your reply.
The problem I cannot use a staging table since the data is sensitive data.
nishav2
nishav2
SSC-Enthusiastic
SSC-Enthusiastic (163 reputation)SSC-Enthusiastic (163 reputation)SSC-Enthusiastic (163 reputation)SSC-Enthusiastic (163 reputation)SSC-Enthusiastic (163 reputation)SSC-Enthusiastic (163 reputation)SSC-Enthusiastic (163 reputation)SSC-Enthusiastic (163 reputation)

Group: General Forum Members
Points: 163 Visits: 103
Hi,
As mentioned below i need to convert varchar field to varbinary in SSIS.Please suggest.
PS : *)Cannot use Staging table.
*)Sensitive data(in my case SSN) should be encrypted on the fly. And should be stored in encrypted format.

ISSUE :
******
I am facing similar kind of problem.I have an SSIS package which has a flat file source and an oledb destination.
I am transferring the flat file content to a SQL table.This SQL table has a column named 'SSN' defined as VARBINARY(300).I need to store the encrypted value in it and not the actual value.
I have created an 'Instead of Insert' Trigger on that table.So this trigger will encrypt and store the value in SSN field.

But in the text file this SSN column comes as Varchar. How to type cast this varchar to varbinary in SSIS package.
I tried to convert the datatype by using Derived column,Data conversion etc.,But it did not work out.

Can anyone help me on this!

Thanks
Nisha V Krishnan
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)

Group: General Forum Members
Points: 88584 Visits: 41130
nishav2 (8/22/2014)
Thanks for your reply.
The problem I cannot use a staging table since the data is sensitive data.


You're saying that your normal data contains clear-text SSNs? And that you can't build a staging table in that same database? Blink

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Eirikur Eiriksson
Eirikur Eiriksson
SSCoach
SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)

Group: General Forum Members
Points: 15450 Visits: 18622
Jeff Moden (8/24/2014)
nishav2 (8/22/2014)
Thanks for your reply.
The problem I cannot use a staging table since the data is sensitive data.


You're saying that your normal data contains clear-text SSNs? And that you can't build a staging table in that same database? Blink


A staging table with the right COLUMN Permissions for the sensitive data looks just about right for this application.
Cool
rxm119528
rxm119528
Mr or Mrs. 500
Mr or Mrs. 500 (512 reputation)Mr or Mrs. 500 (512 reputation)Mr or Mrs. 500 (512 reputation)Mr or Mrs. 500 (512 reputation)Mr or Mrs. 500 (512 reputation)Mr or Mrs. 500 (512 reputation)Mr or Mrs. 500 (512 reputation)Mr or Mrs. 500 (512 reputation)

Group: General Forum Members
Points: 512 Visits: 804
though MS documentation says that Conversion from DT_STR to DT_BYTES is a legal conversion, Nether data conversion or derived column column compopnents seems be doing this right with out throwing a cast error.

http://msdn.microsoft.com/en-us/library/ms141704.aspx

The only way i was able to cast is using the script componenet.


Row.OUPUTCOLUMN = System.Text.Encoding.UTF8.GetBytes(Row.INPUTCOLUMN);

Not sure if your case how far this will be helpful.

Thanks
rm
nishav2
nishav2
SSC-Enthusiastic
SSC-Enthusiastic (163 reputation)SSC-Enthusiastic (163 reputation)SSC-Enthusiastic (163 reputation)SSC-Enthusiastic (163 reputation)SSC-Enthusiastic (163 reputation)SSC-Enthusiastic (163 reputation)SSC-Enthusiastic (163 reputation)SSC-Enthusiastic (163 reputation)

Group: General Forum Members
Points: 163 Visits: 103
Thanks guys for all your valuable suggestions. Will give it a try by using script task..
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search