July 14, 2005 at 1:15 am
oops i was trying to create index on the table authors in pubs database, there it didn't allow me hence decided to create a copy of authors and try n it...(this is the scenario)
Tried Bulk copy statement but seems to be working only for files to table copying, is there anyway i can create a table named authors_copy with the datas of authors in it.
Regards
Arun
July 14, 2005 at 3:06 am
Hi
Right Mouse the table, select All Tasks>Export Data
Follow the wizard through, and just change the destination table name to authors_copy.
July 14, 2005 at 3:15 am
July 14, 2005 at 4:04 am
in Tsql you can use the select into method jsut for testing messing round type stuff.
select *
Into Authors_Copy
from Authors
Other wise I recommend you create the table definition first
Create table MyTable (..
)
Then insert
Insert into MyTable(.....)
Select ...
from Authors
July 14, 2005 at 5:02 am
Thanks a ton Ray, the first one worked like a bub.
But i faltered in trying the second option...created the table sales_copy (copy of sales in pubs database)
here is the sql query...make the amendments on the below query to make it work
create table sales_copy (stor_id char(5),ord_num varchar(5),ord_date datetime default getdate(), qty smallint,payterms varchar(5),title_id varchar(5))
insert into sales_copy(stor_id,ord_num,ord_date,qty,payterms,title_id) select(stor_id,ord_num,ord_date,qty,payterms,title_id) from sales
July 14, 2005 at 5:12 am
Your syntax isn't quite right. Try this:
insert into sales_copy(stor_id,ord_num,ord_date,qty,payterms,title_id)
select stor_id, ord_num, ord_date, qty, payterms, title_id from sales
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
July 14, 2005 at 6:07 am
That worked, but didn't work for the pubs.authors and it worked when i created a table of my own (testing with 2 fields).
Thanks all hope i stop my doubts for 2day...catch you all tomorrow.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply