-2

I want to generate inserts of a database in MSSQL (create an insert statement for each data in my database). In other words, I want to do exactly the same what SSMS can do by Generate Script described here. However, I want to achieve this functionality from Java code, via JDBC.

I was looking through the internet, but the only possible solution I could find, was to use stored procedure - for example, this INSERT statement(s) generator (with some improvements)

EDIT: Since it seems my question was too broad, I would like to clarify it: is there any way, despite stored procedure, to generate inserts vis JDBC?

PastorPL
  • 968
  • 3
  • 17
  • 36
  • "However, I want to achieve this functionality from Java code, via JDBC". Why? What is your goal? – Nikolai Shevchenko May 13 '19 at 11:08
  • My goal is to get a full dump of data of the database, written as insert statements. I need it, because one of the systems I'm working with, consumes this kind of files during its process (we can say, it's kind of transformation process). – PastorPL May 13 '19 at 11:18
  • 1
    And yet the question persists. You know that SSMS has this functionality. You certainly must use SSMS for some tasks. Why do you need to write this functionality yourself? Based on the question, you seem to be looking for a library that you can call to do this - some alternative to SMO for java which I don't think exists. Perhaps it would be achievable in a language that does support SMO. – SMor May 13 '19 at 11:27
  • Ok, thanks for answer :). Remark: Yes, I know that SSMS has this function, but with SSMS I need to has SSMS and manually execute the whole procedure. And in my case, I would like to implement an automatic process of doing this in an environment that could not have SSMS. – PastorPL May 13 '19 at 12:18
  • @SMor Could you please post your comment as an answer? I guess it's the best answer :) – PastorPL May 16 '19 at 09:20

1 Answers1

0

Based on the comment of @SMor - the way to do it is by using SMO. However, it is not implemented in Java. So the answer is to use language that has SMO implemented or use stored procedure.

PastorPL
  • 968
  • 3
  • 17
  • 36