0

I have to dump a customer database without access to their server. This means I cannot use SQL Server Management Studio directly and make 'Tasks' -> 'Generate scripts' to create a .sql file with inserts inside.

Moreover, I know the name of the DB but not the tables and views within.

So how can I create a script which extract all data from tables and create inserts into a .sql file ?

I use SSMS v10 on my PC.

Charlieface
  • 52,284
  • 6
  • 19
  • 43
mtnp
  • 314
  • 7
  • 24
  • 3
    Ask for a backup – Brad Oct 15 '21 at 15:06
  • *"I have to dump a customer database without access to their server."* If you have no access what are you expecting here? Magic? Also SSMS V10? That came out with SQL Server 2008; both are **completely** unsupported.# – Thom A Oct 15 '21 at 15:07
  • 1
    A database backup or bacpac will include both schema and data. – Dan Guzman Oct 15 '21 at 15:10
  • To resume what they want : Just receive from me SQL scripts, paste them in the ssms request window and launch it. They do not want to give me access directly for security purposes. I am supposed to have a copy of their database schemas in my computer and create scripts from that, but it's possible that the target database is different than mine – mtnp Oct 15 '21 at 15:14
  • 4
    Then *they* should be supplying you with a copy of their database schema. If they don't want to give you any kind of access to their isntance to obtain this (which is their prerogative) it is their responsibility to give you the tools to do the job they have asked *you* to do. – Thom A Oct 15 '21 at 15:16
  • Also, when you do get a copy, I suggest updating your version of SSMS (and SQL Server); I would *hope* (read doubt) they are still using SQL Server 2008 or prior. – Thom A Oct 15 '21 at 15:26
  • Ok I was expecting a ssms stored procedure or sql command to do that but it seems that it is not possible. I will continue to looking for a solution and comeback to this question if I find something. Thank you all for you help – mtnp Oct 15 '21 at 15:35
  • Does this answer your question? [Generate SQL Create Scripts for existing tables with Query](https://stackoverflow.com/questions/706664/generate-sql-create-scripts-for-existing-tables-with-query) – Charlieface Oct 15 '21 at 16:30
  • @Charlieface Yeah the idea is to copy SSMS behaviour but more like this one for data : https://stackoverflow.com/a/49537399/5240905 I didn't dive into his code so I cannot say if it's reliable or not. And the name of the table is required – mtnp Oct 15 '21 at 16:44

0 Answers0