0

I have a very simple procedure with comments. Example:

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE test
AS
BEGIN
    -- Single line comment
    SET NOCOUNT ON;

    SELECT GETDATE();
END
GO

The script is saved as encoded UTF-8.

When I migrate this with flyway (successfully) and later check it through the management studio, I see that the multi-line comment is stripped off. Also when viewing the flyway migrated procedure SSMS complains about 'Inconsistent Line Endings'. What am I missing here?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
pinklotus
  • 101
  • 2
  • 13
  • 1
    move the comment below CREATE PROCEDURE - for SSMS this helps - not sure if it helps when doing your migration. Inconsistent Line endings means some end on `\n` and some on `\r\n` mixing windows/linux style line ends – Patrick Artner Nov 10 '17 at 19:46
  • Ok, you are right, the comments are detected after the CREATE PROCEDURE. Thanks. How can I avoid the line ending problem? I am just scripting the procedure in SSMS and saving the file. – pinklotus Nov 10 '17 at 19:55
  • From experience such comments could be useless. Better to track changes in repository like `SVN/GIT`. – Lukasz Szozda Nov 10 '17 at 20:09
  • @lad2025 a history of comment is kindof useless I agree - a documentation of the intent of this procedure, a date of creation and the author could be very valuable especially if you have procs with complicated cursors that span some lines – Patrick Artner Nov 10 '17 at 20:13
  • @lad2025 We are not tracking the changes in the comments. It's just a way to keep track of author or the last person who edited, etc. I do agree that most of this could be done through git. – pinklotus Nov 10 '17 at 21:02

1 Answers1

1

Glad that moving the comment down helped you - as for your 2nd problem:

why i am getting "Inconsistent ending lines" warning window while executing sql script?

Quintessence: find what corrupts it and fix it ;o)

Manually

If you have notepad++ you can clean your scripts by opening them, then Edit/EOL Conversion/ and choose what EOLs you want

kindof automatic

see Windows command to convert Unix line endings? --> be careful with the MORE thing, it kills your file if you use it inplace (inputfile=outputfile)

Patrick Artner
  • 50,409
  • 9
  • 43
  • 69