Hi
I am fetching data from an CHAR(5) COLUMN of an SQL SERVER 2005 database.If the count of number of characters in that column is less than 5,then am getting some unknown characters for the rest...
Example
Column1
AA^@^@^@
aaaaa
b^@^@^@^@
This Unknown character(^@) is not visible from datastage(while viewing the data)
But when i checked the file at the server i found this...this make the string comparison and all fail...
can u guys please help me in resolving this
Thanks
Rakesh
Getting Unknown characters while Fetching from SQL SERVER
Moderators: chulett, rschirm, roy
First step is always to move it from "unknown character" to known by determining the decimal or hex value of the character. A hex editor would make that simple or you can check your man page for "od" to see what your switches are to output the character in something besides octal.
Or you could change your value of $APT_STRING_PADCHAR (that should be pretty close to the actual name) from 0x0 to 0x20 so they are padded with spaces.![Wink :wink:](./images/smilies/icon_wink.gif)
Or you could change your value of $APT_STRING_PADCHAR (that should be pretty close to the actual name) from 0x0 to 0x20 so they are padded with spaces.
![Wink :wink:](./images/smilies/icon_wink.gif)
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Mistakes
Mistakes
Sorry guys...
Craig thanks for your reply....
I had tried by finding the Ascii value of those Character..but its not working as expected...
And when I set the $APT_STRING_PADCHAR to 0x20 the columns with at-least one character's value is coming perfectly.
But if there is no Character then its not happening.
Example
Column1
A
^@^@^@^@^@
Thanks
Rakesh
![Embarassed :oops:](./images/smilies/icon_redface.gif)
![Embarassed :oops:](./images/smilies/icon_redface.gif)
Sorry guys...
Craig thanks for your reply....
I had tried by finding the Ascii value of those Character..but its not working as expected...
And when I set the $APT_STRING_PADCHAR to 0x20 the columns with at-least one character's value is coming perfectly.
But if there is no Character then its not happening.
Example
Column1
A
^@^@^@^@^@
Thanks
Rakesh
rAKESH
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Ctrl-@ is the ASCII NUL character, which is used to pad fixed length strings by default. Setting APT_STRING_PADCHAR to a different character uses that character instead. For the case where SQL Server returns five NUL characters I'd be interested to know what's really stored in SQL Server. You can certainly convert Char(0) to " " in a Transformer stage, but how did the NUL characters get into SQL Server in the first place?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.