We help IT Professionals succeed at work.

Loading  the flat files into Sybase DataBase

expertbala
expertbala asked
on
Medium Priority
618 Views
Last Modified: 2012-06-27

How to Load the flat files(Delimited Data files ..for ex
|bala|35353|hshshhsh|
......
..... etc )

into SyBase DataBase.Is there any utilites like SQLLoader(Oracle DataBase), BCP(SQLServer DataBase) in SyBase DataBase....

please send me the detailed informations ...

Regards
L.Bala
Comment
Watch Question

BCP is available for sybase. Syntax is as follows

bcp DBNAME.OWNER.tableName in flatFile.txt -c -t "|" -r "\n" -U username -P password -S server

just say bcp -h to get all the options.

Thanks.

Author

Commented:
Thanks amit..

you are given the SQLServer BCP syntax..

Ok..

Is there any facilities like BCP of SQLServer in Sybase
whats is that?
Are you help me?

Regards
L.Bala

bala,

though i am not familiar with SQL Server syntax, I guess it would be the same as in Sybase.

what i can suggest is you can achieve your purpose with the help of scripts provided the defintions of tables on boths sides is similar.

bcp out from sqlserver and then bcp in these flat files to sybase server. hope they are compatible.

thanks,
Amit.

Commented:
Hi Bala,

It shouldn't surprise you that Sybase ASE has similar utilities to MS SQL Server, the two products share a common root in Sybase Sql Server version 4.2.

So, for Sybase the usual tool for loading flatfiles is indeed BCP - though there may be some differences since Sybase has also made changes in the product since the 4.2 days.  Documentation for ASE's BCP is available in the "Utilities Guide" at http://manuals.sybase.com/onlinebooks/group-as/asg1250e

-bret
If this is ASE,  Wouldn't one use ISQL.exe or ISQLC.exe Here is an example of a script for ISQL.exe

CREATE TABLE "pcuser"."capgrp"
(
     "cgprof"                  char(15) NULL,
     "cggrpn"                  char(15) NULL,
     "cgrseq"                  smallint NOT NULL,
     "cgresc"                  char(15) NULL
)
go
CONNECT "pcuser" IDENTIFIED BY "SQL"
go
GRANT SELECT, INSERT, DELETE, UPDATE, ALTER, REFERENCES ON "pcuser"."capgrp" TO "pcuser"
go

LOAD TABLE "pcuser"."capgrp"
     FROM 'C:\\QS\\QSLOAD\\capgrp.dat'
     DELIMITED BY '|'
go
CREATE INDEX "capgrp" ON "pcuser"."capgrp"
(
     "cgprof" ASC,
     "cggrpn" ASC,
     "cgrseq" ASC,
     "cgresc" ASC
)
go

commit work
go

Commented:
Perhaps you are thinking of ASA?  You are using some non-ASE tsql there...

-bret
Sorry, You are correct, I was definately thinking ASA,  


 Please, pay no attention to that man behind the curtain.
if you are using Sybase ASE then the suggestion by amitpagarwal should work.
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: amitpagarwal

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

ChrisKing
EE Cleanup Volunteer