Re: table copy



On Mar 29, 12:16 am, Jin <jinsooch...@xxxxxxxxx> wrote:
On Mar 27, 4:08 am, svnat...@xxxxxxxxx wrote:

hai...

  Am using sql server ce2.0 in my target device.. and i would like to
copy my database table to other database... by using the following
query but it doesn't work..(following code embedded with evc++  &
wince platform)

" create table table2 like db1.table1;
 "insert into table2 select * from db1.table1;

sql server ce2.0 support this query..?. it display the error message
always... plz help if anyone have an idea about how to copy the table
from one database to  an other database...it would be fine...

There's no easy way to do this, however if you're willing to code,
then you could certainly achieve it.  The steps involved might be:

1.  Create the target database if needed.
2.  Open the source database.
3.  Retrieve the table schema information via the System Views (i.e.
INFORMATION_SCHEMA.COLUMNS, INFORMATION_SCHEMA.INDEXES, etc.).
4.  Build a list of Column Names for later use.
5.  Build a DDL statement to create the Table and Indexes.  You may
also need the Constraint information if any.
6.  Create the new table on the target database.
7.  Open the source table (preferably using the SqlCeResultSet for
efficiency).
8.  Open the target table (again using the SqlCeResultSet for
efficiency).
9.  Loop through each record from the source table SqlCeResultSet.
10.  Get the SqlCeUpdatableRecord for the target table SqlCeResultSet.
11.  For each column (either using the column index or based on the
list of Column Names saved), set the SqlCeUpdatableRecord value to
respective value from the source SqlCeResultSet.
12.  Perform Insert for the target SqlCeUpdatableRecord.
13.  Done.

Coding something similar to this should take few hours.  The most
difficult part will be to build the correct DDL statement to create
the target table given the variations you can have on the original
table schema.

Good luck.

- Jin

hai jin...

it's working now...thanks very much.. thanks.. thanks
.



Relevant Pages

  • Re: table copy
    ... Am using sql server ce2.0 in my target device.. ... copy my database table to other database... ... Open the source table (preferably using the SqlCeResultSet for ...
    (microsoft.public.sqlserver.ce)
  • Re: Checking for blank rows in database - with apologies to Norman Jon
    ... Define a name ("MyDatabase") for the database area, ... Private Sub Worksheet_Change(ByVal Target As Range) ... Dim rng2 As Range ...
    (microsoft.public.excel.programming)
  • Re: database migration
    ... database size ... write rate of source and target database storage subsystems. ... If your downtime window is large enough, simply copy a cold backup set ... online redo logs to target host ...
    (comp.databases.oracle.server)
  • Re: data migration question. source & target tables are the same-
    ... database into another, bigger, more centralized database in order ... 2 fields in each source table record will need to be populated using data items appearing in other tables of the target database. ... (we will be ousting the source table key of SSN, replacing it with a more benign key item). ...
    (comp.databases.oracle.tools)
  • Fundamental problem setting up SCR
    ... I've setup two new mailbox servers (SOURCE and TARGET). ... I've generated over 50 logs on the database on SOURCE but nothing appeared ... a Standby Continuous Replication copy status for storage group 'SOURCE\SG1'. ... The Microsoft Exchange Replication service may be down. ...
    (microsoft.public.exchange.setup)

Loading