Updating sql server stored procedures/functions/triggesr loose comment

Answered

With SQL Server db when creating stored procedures or functions or triggers, comments before CREATE statement are stored but when updating, comments before UPDATE statement are lost.

To bypass this problem now i need to run DELETE statement and then CREATE.

3
3 comments

Hello,

We have related issue on YouTrack: https://youtrack.jetbrains.com/issue/DBE-6546/Comments-lost-when-saving-View-in-MS-SQL-Server

Seems it's happening whenever there is a gap (of a line), between the end of the comment and the body of the procedure 

0

Any update on this particular issue? I had run into some issues before with Datagrip not saving comments when updating certain things. I can confirm that it only appears to happen when there is a gap between the comments and the body of the procedure. Using Datagrip 2023.2. It also appears this issue happens in both the procedure editor and the query console.

This works in the query console:

-- Comments
create procedure test_procedure
as
begin
    print('testing')
end

This doesn't.

-- Comments

create procedure test_procedure
as
begin
    print('testing')
end

This is also the case for the procedure editor, if there is a gap between the comments and the procedure itself, it doesn't include the comments when updating the procedure.

I can get around this by setting the Settings → Database → Query Execution → For Selection Execute setting to “Exactly as one statement”, but this introduces some other issues (like having to tweak the procedure statement to get it to run correctly), and the procedure editor is not affected by this setting.

If a fix or workaround for this is available that would be amazing!

Thanks!

 

0

Unfortunately, there is no ETA for the mentioned bug. Use the thumbs-up to subscribe to it. Also, feel free to leave comments in order to raise your concerns about it

0

Please sign in to leave a comment.