| Author |
Topic |
|
Exir
Posting Yak Master
151 Posts |
Posted - 2009-09-16 : 01:28:28
|
| Is there any command to import a table with its datas in it? or the only way is createing the table and insert rows one by one? i have no access to sql and i can only execute query on database |
|
|
waterduck
Aged Yak Warrior
982 Posts |
Posted - 2009-09-16 : 01:58:04
|
try select into Hope can help...but advise to wait pros with confirmation... |
 |
|
|
Exir
Posting Yak Master
151 Posts |
Posted - 2009-09-16 : 02:10:30
|
quote: Originally posted by waterduck try select into Hope can help...but advise to wait pros with confirmation...
I think this command if for importing when the table is already exists, but i want to import a table, like when we attach or restore a new database. is it possible ? |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-09-16 : 02:18:39
|
| Select * into new_table from old_tableMadhivananFailing to plan is Planning to fail |
 |
|
|
Exir
Posting Yak Master
151 Posts |
Posted - 2009-09-30 : 01:32:43
|
| This command inserts content of table1 into table2, which the table2 shouldnt be exists in the database, what about if i want to insert content of table1 to a table which exists in my database and is not same as table1, just want two column of these tables be same. is it possible to have bulk insert? for example like insert column1 of table1 to column1 of table2 where column2 of table1= column2 of table2 ? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-09-30 : 01:38:13
|
do you mean this?UPDATE t1SET t1.col1=t2.col1FROM table1 t1INNER JOIN table2 t2ON t2.col2=t1.col2 |
 |
|
|
Exir
Posting Yak Master
151 Posts |
Posted - 2009-09-30 : 01:56:24
|
| my table1 is exactly same as t2 just a column of table2 defined as PK and its identity specification is true, so i want insert all the content of columns in table1 into table2 without any condition.How can i do this ? |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-09-30 : 02:03:18
|
| UPDATE t1SET t1.col1=t2.col1FROM table1 t1INNER JOIN table2 t2ON 1=1MadhivananFailing to plan is Planning to fail |
 |
|
|
Exir
Posting Yak Master
151 Posts |
Posted - 2009-09-30 : 02:05:46
|
| Dear Mahdaivanan my table2 is empty, i think i have to write insert command, yes ?should i insert row by row manually like "INSERT INTO table1(cilumn) VALUES ('value1')" or i can have bulk insert ? |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-09-30 : 02:24:36
|
| Insert into table2(columns)select columns from table1MadhivananFailing to plan is Planning to fail |
 |
|
|
Exir
Posting Yak Master
151 Posts |
Posted - 2009-09-30 : 02:38:42
|
| yesss, it works, thanks alot |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-09-30 : 05:17:21
|
quote: Originally posted by Exir yesss, it works, thanks alot
You are welcome MadhivananFailing to plan is Planning to fail |
 |
|
|
|