Showing posts with label contain. Show all posts
Showing posts with label contain. Show all posts

Wednesday, March 21, 2012

Move/Copy Table(s) Between Databases

I need to learn how to move or copy a couple of tables from one database to another. The tables are defined but contain no data.Quick and easy an INSERT INTO statement but avoid SELECT INTO. Run a search for both in the BOL(books online). Hope this helps.|||Thanks Caddre but I've learned I can use the 'Export Data' DTS Wizard which is fast and easy.

Saturday, February 25, 2012

move database record

hi,

i have no problem to select all records from the table, but how to copy or move these selected records to other table which contain same field as the orriginal.

thanksINSERT INTO table2 (col1, col2, col3...)
SELECT col1,col2, col3
FROM table1
WHERE ...|||ndinakar, can u guide me more details. example i have one table call student, inside got id and name and move this record to a table call student2. can u guide me complete sql statement, because i new to the sql, i bit confuse in line 1 and line 2. thanks

INSERT INTO table2 (col1, col2, col3...)
SELECT col1,col2, col3

FROM table1
WHERE ...|||

INSERT INTO student2 (id,name)
SELECT id,name
FROM student
WHERE {something}

{something} could be ID=some number or name='some name' etc

|||is't this method is for one reord only? how about if i want to move 1000 records from table student to table student2 ?. thanks|||

You move as many records as your SELECT statement returns.