Page 1 of 1

automatic stored procedure creation

Posted: Fri 30 Nov 2012 21:12
by firebird_hunter
Hi there,

is in dbForge a function available to create automatically insert/update stored-procedures for a given table? If not, will it be on the roadmap?

Regards,

firebird_hunter

Re: automatic stored procedure creation

Posted: Tue 04 Dec 2012 11:06
by alexa
This functionality is implemented in dbForge Studio for SQL Server.

A stored procedure or function can be generated as follows:

1. Expand a database in Database Explorer.
2. Expand the 'Programmability' node under the database.
3. Right-click the 'Procedures' or 'Functions' node and select the corresponding item from the popup menu.

The 'INSERT' and 'UPDATE' statements for a table can be generated as follows:

1. Expand a database in Database Explorer.
2. Expand the 'Tables' node.
3. Right-click a table and select 'Generate Script As -> INSERT/UPDATE' from the popup.

or

1. Select 'File -> New -> Query' from the main menu. The Query Builder diagram opens.
2. Right-click on the diagram and select 'Change Type -> Insert Results/Insert Values/Update' from the popup menu.
3. Click the ellipsis at the top left corner of the diagram and select a table.
4. Select columns on the table representation on the diagram.
5. Switch to the 'Text' tab at the bottom left corner of the diagram.

Re: automatic stored procedure creation

Posted: Tue 04 Dec 2012 13:47
by firebird_hunter
Dear alexa,

I guess you did not get me idea right.
I like to right click a table name and dbforge should produce a stored procedure for insert/update out of it, like

Code: Select all

CREATE PROCEDURE tblTest1_IU 
    @id Int,
    @[user] Int,
    @stamp DateTime2(6) AS
BEGIN
  IF EXISTS ( SELECT * FROM dbo.tblTest1 WHERE id = @id)
  UPDATE dbo.tblTest1 SET
    [user] = @[user],
    stamp = @stamp
  WHERE
    id = @id
  ELSE
  INSERT INTO dbo.tblTest1 (
    id,
    [user],
    stamp)
  VALUES (
    @id,
    @[user],
    @stamp)
END
Your given way is by foot, in this case I am faster writing the procedure from the scratch...

Re: automatic stored procedure creation

Posted: Wed 05 Dec 2012 14:24
by alexa
Thank you for clarifying this.

This is a great idea. We added it on your behalf on our UserVoice forum to find out its importance for other users.