Ok I am a bit nearer. I have managed to use use query options and set the delimiter to comma then run a query setting it to store to a csv file. That doesn't quite work though. It is fine unless you have a comma as part of a field entry. O dear. It isn't the whole data we want to copy - just data from a couple of tables. I understand the Bulk insert from a csv file. I hadn't come across that before. Thanks
Importing into sql server management studio
I can see hw to create a files of sql commands from a database table but how do import it into another test database please. Do I use import flat file as taht appears to be for csv files. Thanks
8 answers
Sort by: Newest
-
-
AmeliaGu-MSFT 13,991 Reputation points Microsoft Vendor
Jan 27, 2021, 6:08 AM Hi @Pamela Whittaker ,
how do import it into another test database?
Did you mean you want to import the data to another database? You can right-click on your database and select Tasks -> Generate Scripts...
In Set Scripting Options page, you can specify how scripts should be saved. And you can select the Types of data to script to be Data only in Advanced button.If you have to perform large imports of data from a csv file, you can use BULK INSERT statement as YitzhakKhabinsky mentioned. Or you also can use SQL Server Import and Export wizard by choosing Flat File Source as Data Source with file name. Please refer to Bulk Import and Export of Data and this simple example of the Import and Export Wizard which might help..
If you have any other question, please feel free to let us know.Best Regards,
Amelia
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread. -
Pamela Whittaker 1 Reputation point
Jan 26, 2021, 8:45 PM What if you have a large file of
insert into .....
insert into .....
insert into .....
insert into .....
insert into .....The on;y thing I can think of is create new query then copy and paste
-
Tom Phillips 17,741 Reputation points
Jan 26, 2021, 7:58 PM Use the import/export wizard.
-
Pamela Whittaker 1 Reputation point
Jan 26, 2021, 5:21 PM Bult inserts won't work will it on a file of insert statements?