| Author |
Topic |
|
doggi3
Yak Posting Veteran
62 Posts |
Posted - 2004-09-01 : 04:34:56
|
| I have two tables here. Can I simply highlight the table and select all rows and copy it into another table?I tried. But the result all ends up in one single column. How do I get it to work?- HELP - |
|
|
timmy
Master Smack Fu Yak Hacker
1242 Posts |
Posted - 2004-09-01 : 04:48:41
|
| Depends on your front-end app. Multi-row cut & paste works fine in Access. |
 |
|
|
doggi3
Yak Posting Veteran
62 Posts |
Posted - 2004-09-01 : 04:49:55
|
| I am using SQL Server Enterprise Manager... Can it be done?- HELP - |
 |
|
|
doggi3
Yak Posting Veteran
62 Posts |
Posted - 2004-09-01 : 05:16:32
|
| I actualli want to copy rows from Table A(Ocma_2900113_PH_UTF8_8_27_2004_7000) to Table B(ocma_2900114_PH_UTF8_8_27_2004).To show rows from Table B (ocma_2900114_PH_UTF8_8_27_2004), I use the following query:Select * FROM ocma_2900114_PH_UTF8_8_27_2004WHERE ((EMAIL_ADD_NM + PERS_LAST_NM) NOT IN (SELECT email_add_nm + pers_last_nm FROM Ocma_2900113_PH_UTF8_8_27_2004_7000)) So, in order to insert these rows into Table A (Ocma_2900113_PH_UTF8_8_27_2004_7000), do I do this query:INSERT INTO Ocma_2900113_PH_UTF8_8_27_2004_7000Select * FROM ocma_2900114_PH_UTF8_8_27_2004WHERE ((EMAIL_ADD_NM + PERS_LAST_NM) NOT IN (SELECT email_add_nm + pers_last_nm FROM Ocma_2900113_PH_UTF8_8_27_2004_7000))- HELP - |
 |
|
|
timmy
Master Smack Fu Yak Hacker
1242 Posts |
Posted - 2004-09-01 : 05:30:06
|
| So you're not using a cut & paste then?For your insert query, you should specify a field list in the insert, and also specify the fields in the SELECT. |
 |
|
|
doggi3
Yak Posting Veteran
62 Posts |
Posted - 2004-09-01 : 05:35:24
|
| I want to use cut and paste. It is much easier this way. But I will like to ask if it is possible in SQL Server Enterprise Manager.If I realli can't use cut and paste, then I will have to use query. But I have 103 columns in each table. So I have to type out the column names one by one?- HELP - |
 |
|
|
benjamintb
Starting Member
15 Posts |
Posted - 2004-09-01 : 06:04:39
|
| Could you just copy the entire table and then rename it? if you have less than 103 fields in the table already maybe its easier to copy any other fields that you need to add later by using insert? |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2004-09-01 : 06:14:18
|
| well you dont need to write all 103 colums by hand :)))this wil give you a CSV string of column names in the tableDeclare @ColumnList varchar(1000)SELECT @ColumnList = COALESCE(@ColumnList + ', ', '') + column_name FROM INFORMATION_SCHEMA.ColumnsWHERE table_name = 'TableName' --and Ordinal_position between 0 and 20SELECT @ColumnListGo with the flow & have fun! Else fight the flow :) |
 |
|
|
rockmoose
SQL Natt Alfen
3279 Posts |
Posted - 2004-09-01 : 09:01:30
|
| To avoid typing:In QA, expand the table, drag and drop the Columns folder into the workarea.spirit1's suggestion is also good :-).Please, don't do Copy/Paste, it is not easier.When You feel more confident with T-SQL, that is the way to do this.So did You solve the data problems/issues ?rockmoose/* Chaos is the nature of things...Order is a lesser state of chaos */ |
 |
|
|
|