473,403 Members | 2,183 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

SSIS and HEX conversion.

TonFrere
Hello,
I must convert a CSV file which is simply hexadecimal words. There is a SSIS function to convert from decimal to hex but none for either hex to decimal or hex to ASCII.
Here is what my file looks like:
3032;3631;3031
3032;3631;3032

Here is what it should give:
026101
026102

I already started a DataFlow task which seperates each hex combo into different columns and get rid of the semicolons. The next step would have been to convert each column contain into ASCII digits but to my surprise, there is no function to do that.

Is there a way to:
- Create my own SSIS function and use it in the Derived Column tool.
- Process all rows given by my DataFlow task into C# or VB?

Or maybe I'm just doing this wrong from the start.

Any thoughts?
Justin
May 1 '08 #1
5 19547
ck9663
2,878 Expert 2GB
Can CONVERT() handle it?

-- CK
May 1 '08 #2
Can CONVERT() handle it?

-- CK
I can't seem to find CONVERT() in the list of SSIS functions. What I did was to create an Script Component (duh!) and convert each column using VB code. I just wish I could find a more user-friendly solution.

Here is the VB code (thanks to google):
Row.Digit1 = Chr(CInt(Val("&H" & Row.Digit1.ToString()))) 'Digit1 is the name of the column
[...]

The CInt function was recommended by VS auto-corrector(??). Without it I had this error: "Option Strict On disallows implicit conversions from 'Double' to 'Integer'." I must admit I don't know why but it works so, what the hell!

Can I use C# code in an SSIS script?
Justin
May 1 '08 #3
srinig
1 Bit
Hi,

I got similar situation to convert to hex...I believe we can use c# script with in SSIS.

I am new to c#, Can you share your script here ?
Jul 4 '23 #4
cactusdata
214 Expert 128KB
Use Substring or other method to split your string into its single values:

30, 32, 36, 31, etc.

Now, convert each of these, here '36' to return '6':
Expand|Select|Wrap|Line Numbers
  1. Char(Convert(int,Convert(binary(1), '0x' + '36', 1)))
Then concatenate these single characters to build the full string.
Jul 5 '23 #5
KRITGuy
6 Nibble
I use this in my Classic ASP. Oftentimes I transfer Notes from a Memo Field in a VB App to an Access Database on a simple IIS HTTP Server.

So that sort of data is expanded to 7-bit and hexed.

In the ASP Page it's converted with my HexToASCII function:

Cheers,
Kevin

<%
FUNCTION HexToASCII (Param)
HexToAscii = Param
Command = ""
BYTES = LEN(Param)
FOR i = 1 to BYTES
HV = "&H" & MID(Param,i,2)
HB = CInt(HV)
Command = Command & CHR(HB)
i = i + 1
NEXT
HexToAscii = Command
END FUNCTION
%>
Jul 10 '23 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: stant | last post by:
I am trying to call a mainframe cobol DB2 Stored Procedure from an SSIS 2005 SQL Task in BIDS. I believe that privileges and the number of parameters (6) are fine. I've tried casting and still have...
0
by: AMAN | last post by:
Hi all, I am a newbie to SSIS.Need a solution to couple of issues I am currently facing while developing ETL in SSIS 1) Under SSIS Package Folder I have defined mappings for 17 dimensions....
1
by: SQLNewbie | last post by:
Hi all, New to SQL Server - trying to create an SSIS package that will look for and import a series of Visual Foxpro tables (.DBFs) when they appear in a folder. The tables are/can be all...
1
by: oregondba | last post by:
We are attempting to load a DB2 v9 table with SQL Server Integration Services. The DB2 data exists on AIX and is built with a codeset of 1252. The SSIS server has the DB2 V9 client and we are...
1
by: rmsterling | last post by:
All, Subject : SQL Server 2005 SSIS Script Help - XML Secure Pull in to DB table I was wondering if any of you could help me with something..... I want to design a SSIS script that will pull...
9
by: gelangov | last post by:
I have 2 variables, one is the column name of the table and the other one is the table name and I need to write this in the "Execute SQL task" of a "For each loop" container in a ssis package like...
6
by: jags_32 | last post by:
We have spent days trying to perform a proof of concept and I am dissappointed with SSIS to say the least. We are trying to connect and fetch data from a Double Byte Progress database and the...
0
by: Deven Oza | last post by:
Hi All, I have created SSIS package and I wanted to transfter data from two different tables to excel sheet and when I used union all function its return me error says cannot convert into unicode,...
1
by: vineetbindal | last post by:
Hi All, We hava a coloumn with float values and we are writing it in a text file. the data type in ssis is DT_R8. and DataScale is 2. that means if we are sending a value like 34.40 it...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.