[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

[sqr-users] RE: sqr-users Digest, Vol 44, Issue 1




I've used bcp to import text files into Sybase tables quickly.  Here's an 
example (you need to fill in the userid, password & server):

let $comand = 'bcp cust in aaaa.txt -c -X -U userid -P password -S server'
display $command
call system using $comand #statuscode
if #statuscode <> 0
   display 'bcp failed'
   stop
else
   display 'bcp successful'
end-if

I initially put it in a temp table, then I can run whatever edits I need before 
inserting all the rows from the temp table into the real table.  But if you 
know that all your data in the temp table is ok, then you may be able to bcp 
directly into your real table.



-----Original Message-----
Date: Thu, 27 Sep 2007 14:57:38 -0400
From: maddy <madhudvm@gmail.com>
Subject: [sqr-users] Loading fixed length flat file into Sybase table
To: "This list is for discussion about the SQR database reporting
        language        from Hyperion Solutions." <sqr-users@sqrug.org>
Message-ID:
        <f09cef0f0709271157v57b22d30g6d726253317f3a68@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

 Hi,

What is the better way to load the data from fixed length flat file into a
sybase database table using SQR. Number of rows in the file vary from 10,000
to 50,000

I'm doing something like the code below, but my concern is for each insert
statement it goes to the database and could be performance issue.
**************************************************************************************************************************
open 'aaaa.txt' AS 100 for-reading record=600:fixed status=#z

while 1

read 10 into $name:40 $Id:30 $location:50

if #end-file

break

end-if

begin-sql

insert into cust (name, Id, location)

values ($name, $ID, $location)

end-sql

add 1 to #inserts

if #inserts >= 100

begin-sql

commit transaction

begin transaction

end-sql

move 0 to #inserts

end-if
end-while
************************************************************************************************************
Thanks!!
Maddy



------------------------------

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users



 


CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, 
is for the sole use of the intended recipient(s) and may contain confidential
and privileged information or otherwise protected by law.  Any unauthorized
review, use, disclosure or distribution is prohibited.  If you are not the
intended recipient, please contact the sender by reply e-mail and destroy
all copies of the original message.

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users