Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2008
    Posts
    5

    Unanswered: Export data from MS SQL to Sybase

    Can anyone help me with this issue?

    Currently my MS SQL is on Windows and SyBase is on Unix.

  2. #2
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    Use bcp -c
    use MS SQL bcp to bcp out the data in character mode
    do a ASCII ftp to UNIX
    use Sybase bcp to load the data

  3. #3
    Join Date
    Jul 2008
    Posts
    5
    Quote Originally Posted by pdreyer
    Use bcp -c
    use MS SQL bcp to bcp out the data in character mode
    do a ASCII ftp to UNIX
    use Sybase bcp to load the data
    Thx pdreyer!
    Have you ever tried to do that way?
    And what do you mean by saying "do an ASCII ftp to UNIX"?

  4. #4
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    Maybe an example will help you
    create target table in Sybase e.g.
    Code:
    1> create table tempdb..pdreyer
    2> (id int
    3> ,name varchar(50)
    4> ,crdate datetime)
    5> go
    Now from MS SQL I created some dummy data using osql
    then used MS SQL bcp to transfer the data out
    Code:
    C:\tmp>osql -Usa -Smssql1 -w333
    Password:
    1> select id,name,crdate into tempdb..pdreyer
    2> from master..sysobjects where id<100
    3> go
    (38 rows affected)
    1> exit
    C:\tmp>"C:\Program Files\Microsoft SQL Server\80\Tools\Binn\bcp" tempdb.dbo.pdreyer out pdreyer.txt -Usa -Smssql1 -c
    Password:
    
    Starting copy...
    
    38 rows copied.
    Network packet size (bytes): 4096
    Clock Time (ms.): total        1
    If you have the Sybase client installed you can now use Sybase bcp e.g.
    Code:
    C:\tmp>%SYBASE%/%SYBASE_OCS%/bin/bcp tempdb..pdreyer in /tmp/pdreyer.txt -Usa -Ssyb1 -c
    Password:
    
    Starting copy...
    
    38 rows copied.
    Clock Time (ms.): total = 78  Avg = 2 (487.18 rows per sec.)
    else ftp the data to your unix host
    ftp is in either binary or ascii mode
    you must use ascii mode e.g.
    Code:
    C:\tmp>ftp unixhost1
    Connected to unixhost1.
    220 unixhost1 FTP server ready.
    User (unixhost1:(none)): sybase
    331 Password required for sybase.
    Password:
    230 User sybase logged in.
    ftp> cd /tmp
    250 CWD command successful.
    ftp> ascii
    200 Type set to A.
    ftp> put pdreyer.txt
    200 PORT command successful.
    150 Opening ASCII mode data connection for pdreyer.txt.
    226 Transfer complete.
    ftp: 1539 bytes sent in 0.00Seconds 1539000.00Kbytes/sec.
    ftp> quit
    221-You have transferred 1539 bytes in 1 files.
    221-Total traffic for this session was 1923 bytes in 1 transfers.
    221-Thank you for using the FTP service on unixhost1.
    221 Goodbye.
    now on unix host e.g.
    Code:
    $SYBASE/$SYBASE_OCS/bin/bcp tempdb..pdreyer in /tmp/pdreyer.txt -Usa -Ssyb1 -c
    Password: 
    
    Starting copy...
    
    38 rows copied.
    Clock Time (ms.): total = 7  Avg = 0 (5428.57 rows per sec.)

  5. #5
    Join Date
    Jul 2008
    Posts
    5
    Quote Originally Posted by pdreyer
    Maybe an example will help you
    create target table in Sybase e.g.
    Code:
    1> create table tempdb..pdreyer
    2> (id int
    3> ,name varchar(50)
    4> ,crdate datetime)
    5> go
    Now from MS SQL I created some dummy data using osql
    then used MS SQL bcp to transfer the data out
    Thx!
    I'll try to.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •