Issues with deploying SQL scripts
ag97690
Posts: 3 New member
I am seeing issues with the SQL Scripts used in deployment after comparing databases. Commands in SQL are not getting spaced correctly causing errors when I try to run them in SSMS. The SQL setup that I am using is Compare 12.0.20.2791, SSMS 2016, SQL 2012 and SQL 2008R2 servers. I am comparing a database on SQL 2012 against SQL 2008R2 and both databases are set to compatibility level 100. The script is trying to create stored procedures to the 2008 R2 database. Some of the spacing happens with where statements, Integer statements , Set statements and more. Some examples are:
1. "intASSET NOCOUNT ONDELETE from" which should be "int AS SET NOCOUNT ON DELETE"
2. "OUTPUTASSET NOCOUNT ONINSERT INTO PROJECT" which should be "OUTPUT AS SET NOCOUNT ON INSERT INTO PROJECT"
3. "[update_date] = @update_dateWHERE" which should be "[update_date] = @update_date WHERE"
So from what I can see either carriage returns or spaces are being lost when creating the deployment scripts for a large amount of stored procedures.
1. "intASSET NOCOUNT ONDELETE from" which should be "int AS SET NOCOUNT ON DELETE"
2. "OUTPUTASSET NOCOUNT ONINSERT INTO PROJECT" which should be "OUTPUT AS SET NOCOUNT ON INSERT INTO PROJECT"
3. "[update_date] = @update_dateWHERE" which should be "[update_date] = @update_date WHERE"
So from what I can see either carriage returns or spaces are being lost when creating the deployment scripts for a large amount of stored procedures.
Comments
This sounds like a text encoding issue, but it's hard to locate the problem since there are subtly different ways of exporting the script. Would you mind letting me know which of these methods work?
- Does the script look OK in the SQL Compare deployment wizard?
- Can you run the script using "Deploy Now" in SQL Compare?
- Does it look OK if you click "Save Script"?
- Does it look OK if you press the "Copy" button and paste into Notepad or SSMS?
- Does it look OK if you select all the text and copy it with keyboard shortcuts? (Ctrl+A, Ctrl+C)
- What locale (language) is your local machine using?
Redgate Software
- Does the script look OK in the SQL Compare deployment wizard?
No
- Can you run the script using "Deploy Now" in SQL Compare?
It is listing it out wrong, but it looks like it correctly added itself to the other database when finished.
- Does it look OK if you click "Save Script"?
Same spacing issue.
- Does it look OK if you press the "Copy" button and paste into Notepad or SSMS?
No
- Does it look OK if you select all the text and copy it with keyboard shortcuts? (Ctrl+A, Ctrl+C)
posting it to notepad actually removed most of the spacing structure and the words still run together.
- What locale (language) is your local machine using?
English (United State)
Does it matter what encoding I am using? under application options for Encoding I am currently set to use Unicode (UTF-16)
The reproduction I found uses the Carriage Return character without a Line Feed - can you check whether your function definition contains this kind of line ending?
Redgate Software
Cheers,
Redgate Software