Converting ULONG (4 byte binary) int VB Long / SQL INT for DTS Import 
Author Message
 Converting ULONG (4 byte binary) int VB Long / SQL INT for DTS Import

Can anyone please help me, I'm trying to import a text file containing ULONG
fields into SQL Server 7 using DTS.

Problems:
1. How do I convert the ULONG (4 byte binary) into VB Long or SQL INT to pass
it  to SQL Server? Any ideas gratefully received

2. DTS doesn't recognise the binary data and truncates the record in the
properties set-up.

3. How do I get the hex of a character / string in VB? And how to then convert
it into an LONG.

Thanks in advance,
Brian Boyce, MCP
Alphatec Software Ltd



Sun, 21 Oct 2001 03:00:00 GMT  
 Converting ULONG (4 byte binary) int VB Long / SQL INT for DTS Import
    You can read it into a Double and then:

Function UnsignedToLong(num As Double) As Long
    If num >= 2147483648# Then
        UnsignedToLong = CLng(2147483647# - num)
    Else
        UnsignedToLong = CLng(num)
    End If
End Function

    To go the other way:

Function LongToUnsigned(num As Long) As Double
    If num < 0 Then
        LongToUnsigned = 2147483647# - num
    Else
        LongToUnsigned = num
    End If
End Function

--
Paul Parkhurst
Software Engineer

Quote:

>Can anyone please help me, I'm trying to import a text file containing
ULONG
>fields into SQL Server 7 using DTS.

>Problems:
>1. How do I convert the ULONG (4 byte binary) into VB Long or SQL INT to
pass
>it  to SQL Server? Any ideas gratefully received

>2. DTS doesn't recognise the binary data and truncates the record in the
>properties set-up.

>3. How do I get the hex of a character / string in VB? And how to then
convert
>it into an LONG.

>Thanks in advance,
>Brian Boyce, MCP
>Alphatec Software Ltd



Sun, 21 Oct 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. HELP:Importing a 4 byte binary field (ULONG) into SQL 7 Int / VB Long

2. Converting ULONG binary in SQL Server INT (esp in DTS)

3. Converting BitArray to Int and Int to BitArray

4. Convert Int to Str & Str to Int

5. int main( int argc, char *argv[]) in VB??

6. Converting C unsigned Int and Long data types?

7. Need to convert hex field to long int

8. Converting C unsigned Int and Long data types?

9. Convert INT to BINary

10. Import text file int sql server

11. How to display int, short int range values

12. Int to Str or Str to Int ??

 

 
Powered by phpBB® Forum Software