RE: [PHP-WIN] copying MS SQL tables
| From: | HKG) | Date: | Thu, 18 Mar 2004 16:15:16 +0000 |
| Subject: | RE: [PHP-WIN] copying MS SQL tables | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-23183@lists.php.net to get a copy of this message | ||
You need isql.exe to create a table on the remote machine if you
want to do everything in a script, alternatively you can create
the table with php and mssql_query().
On Thu, 2004-03-18 at 15:55, Gerardo Rojas wrote:
> OK, i'm able to copy over data using bcp, how do I take this file and create a table into
> another remote db server. It fails on the name (of the table) because it doesn't exist yet.
>
> bcp $tablename in $sourcefile $myargs
>
> --
> Gerardo S. Rojas
> mailto: grojas@strategicinc.com
>
>
> -----Original Message-----
> From: Svensson, B.A.T. (HKG) [mailto:B.A.T.Svensson@lumc.nl]
> Sent: Wednesday, March 17, 2004 2:12 PM
> To: Gerardo Rojas
> Subject: RE: [PHP-WIN] copying MS SQL tables
>
>
> In the command shell, just type "bcp"and it will output the paramters.
>
> Typical you should run it like this for import (from memory):
>
> bcp <db>..<table> in <input file> -a1000 -b1024 -c -S<servername>
> <-P<passwd> -U<user> | -T> -t\t -r\t
> "
>
> like:
>
> bcp mydb..testtable in testdata.txt -a1000 -b1024 -c -S127.0.0.1 -R -r\t
> -t\t
>
> a: batch size
> b: packet size
> c: charchater data (needed if data is a text file)
> S: sername
> P: passwd
> U: user name
> T: trusted
> t: filed delimiter (\t == tab, char(9))
> r: row delimiter (it can be buggy with \n)
>
> The order of the parma does not matter.
>
> To dump data use key word "out" in stead of "in".
>
> -----Original Message-----
> From: Gerardo Rojas
> To: Svensson, B.A.T. (HKG)
> Sent: 17-3-2004 21:00
> Subject: RE: [PHP-WIN] copying MS SQL tables
>
> Svensson,
>
> can you provide a quick example of using bcp. When I run my script i
> know what the table will be. Don't know what parameters are need and in
> what order. It complains about the direction.
>
>
> --
> Gerardo S. Rojas
> mailto: grojas@strategicinc.com
>
>
> -----Original Message-----
> From: Svensson, B.A.T. (HKG) [mailto:B.A.T.Svensson@lumc.nl]
> Sent: Wednesday, March 17, 2004 1:58 PM
> To: 'Frank M. Kromann '
> Cc: ''php-windows@lists.php.net' '
> Subject: RE: [PHP-WIN] copying MS SQL tables
>
>
> > use the Data Transformation Service (import/export)
> [...]
> > another. Thats the fastest way to do this.
>
> How many rows is it in the tables you copy?