This blog is specifically written to give pointer and guidance to the dreaded problem SQL01260: A fatal parser error occurred.
If you have been working with TFS database project, you may have generated data by using the data compare tool. Then in theory, if you put the script generated by data compare feature into Post-Deployment script. Usually this would work, but once awhile, when you include a data script, you get the following error: SQL01260:A fatal error occurred.
There are a few reason this would happen, for example you have violated db integrity with incorrect forgein keys. But these problems are easy to figure out and fix. However, if you get this error no matter what you do, and you could run the data script in SSMS without failture, then you encountered a TFS bug.
First let me describe the data script. I generated a data script with this in one of the columns -- :$(''''document'''').ready(function() -- I get this script becuase my database keeps some javascript. Now, I can run the script in SSMS, but if I include this script in Script.PostDeployment.sql, TFS database project would not even build.
To solve this problem, I logged a ticket with Microsot support, and looked around internet. There was no way to resolve this. So a Microsoft engineer and I came up with an workaround: replace all $( with "$"(, this will allow you to compile TFS database project and deploy it. After you deploy, you need to do a search and replace to put all "$"( back to $(.
TFS SQL parser is not the same as SQL parser, so it thinks $( as a varaiable replacement, that's why it can't parse this $(document) thing. Of course, you may not have $(, but have other unrecognizable format. One way to figure this out is to run SQLCMD mode, then you can see it fail on the exact line, then apply the fix I moved above.
Finally, if your goal is to use TFS to deploy data, and don't need to have a local deployment working, you could wire up a build process with this data folder, then do a sqlcmd -x deployment. sqlcmd -x will ignore all variable replacement, and hence ignore $(.