Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to write a batch script to run a bunch of T-SQL scripts I keep in version control. The scripts update objects in the database. The script seems to be working fine. The problem is that when I then script the objects back out to the files, there is an extra newline before the end of the script. This causes all of my scripts to show that they were changed when all that has changed is a single newline. If I were to continue this procedure for a while, I would end up with a lot of blank space at the end of each script. I am using the following command to run each script:

sqlcmd -S "(local)" -d "MyDatabase" -E -I -i "MyScript.sql"
share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

I think the problem is with SQL Server's script generator, see this bug report for more info.

share|improve this answer
    
It says that was closed as fixed, but it doesn't say when. It looks like they planned to fix it in a service pack of SQL Server 2005 and I am running 2008. –  Schmalls Aug 31 '12 at 21:31
    
Also, it says the newlines would show at the beginning of the file and mine are showing up at the end. However, I am relatively certain that the problem is with the script generator. –  Schmalls Aug 31 '12 at 21:32
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.