473,626 Members | 3,443 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SSIS and HEX conversion.

TonFrere
14 New Member
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 19662
ck9663
2,878 Recognized Expert Specialist
Can CONVERT() handle it?

-- CK
May 1 '08 #2
TonFrere
14 New Member
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.ToSt ring()))) '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 New Member
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 Recognized Expert New Member
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 New Member
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
5288
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 no luck. The error is SQL0440N. I am running with DB2 Client 8.2.4. The sql call in BIDS looks like... call ODW.ODWCY002 ('TN',cast '43','04/20/2006',0,' ',' ') the linkage section in the cobol sp looks like... 01 LK01-ODW-ST-CD...
0
1822
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. 1st Dimension say Account has been Set up as a startup object. Now when I run the package ir runs only my account dimension and loads the target,other dimensions are not run at all!
1
9290
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 different fields, field widths, etc. With quite a bit of overlap though. The end result should be table "ABC.DBF" is pulled into SQL Server as
1
3381
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 using the OLE/ DB driver. When we try and connect the two SSIS insists that we have to treat the char (and varchar) data as Unicode. At this point I believe the issue is most likely being caused by either SSIS or the DB2 OLE/DB driver. Has...
1
1907
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 XML data from a secure HTTP website direct in to a local database table. I have had no training on SQL Server 2005 SSIS. I have a reasonable
9
10491
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 this: Truncate table <tableName> Insert into <tableName> Exec (' select from '+ ?) It gives me error message when I try run the ssis. However if I put the above statements into a stored procedure and wrote look this, it
6
6093
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 "DataReader Source" using a ADO .NET ODBC provider does not work! I understand that SSIS is a totally rewritten version of DTS. What annoys me is that this functionality used to work in DTS and does not in the much talked about SSIS!! Will someone in...
0
2531
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, I already used Data Conversion Transformation but didn't help, what should I do please advice. Please note: both tables have different column names. Thanks, DB
1
3799
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 should write the same value in destination file. but what it does is 34.3999999999999999 i am confused why is i doing that?
0
8202
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8707
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8641
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8510
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7199
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5575
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4202
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1812
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1512
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.