Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Script to Insert data
Message
De
12/11/2004 09:05:41
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Divers
Thread ID:
00960451
Message ID:
00960799
Vues:
44
Thank you.

So if I want to preserve my test data in table Table1 before I restore from a backup in which Table1 will be empty, I can create a database to hold the backup tables, create a table1 in database2 and fill it with test data copied from database1 as shown below ( assume I just prefix the tablename with the database name database1!table1 ?) And then after restoring backup for database1, reverse the process filling table in database1 from database2. Is that the best approach?

Now, suppose I want to send my test data to a collegue? Would I just backup my database2 and send him that or is there a better way?

( If I wanted to send a collegue a totally new table structure, or a change in structure, I would just create a script that Enterprise manager would generate for me. I guess I was hoping for a similar way to create a script with insert into statements based on existing data which I would send to someone else and they could run from QA and fill their table with this data. In VFP I would create a delimited file they could append from, but I'm still floundering on figuring out the SQLServer equivalent. )

Appreciate your insights on this as you are fluent in both languages ( and, I suspect, many others <g> )

TIA

>You can use INSERT INTO SELECT FROM command
INSERT INTO table2 SELECT * FROM table1
>
>>Thought I would point this directly at you since you will probably be the one to answer <s>
>>
>>I understand how to create a script to create a table. But how would I create a script to have insert commands to populate a table with data existing in a current table.
>>
>>I am working on a project with other developers. I periodically have to restore a backup of the common database we are using, but I have sometimes dummied up test data in one of the tables in my local installation. I would like to create a sql script that does inserts of this data into the same table once it has been restored from backup ( where it is probably empty )
>>
>>Hope the question makes sense. I am sure there is some easy way to accomplish this, but short of writing out the script manually the solution is eluding me
>>
>>TIA


Charles Hankey

Though a good deal is too strange to be believed, nothing is too strange to have happened.
- Thomas Hardy

Half the harm that is done in this world is due to people who want to feel important. They don't mean to do harm-- but the harm does not interest them. Or they do not see it, or they justify it because they are absorbed in the endless struggle to think well of themselves.

-- T. S. Eliot
Democracy is two wolves and a sheep voting on what to have for lunch.
Liberty is a well-armed sheep contesting the vote.
- Ben Franklin

Pardon him, Theodotus. He is a barbarian, and thinks that the customs of his tribe and island are the laws of nature.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform