What are the challenges you face when working across database platforms? Take the survey
Options

Using SsdtCompatibleOptions from Command Line

rhandloffrhandloff Posts: 2 New member
edited December 10, 2016 1:19AM in SQL Compare
I'm trying to generate a whole mess of script folders from some SQL Snapshots using PowerShell to call the SQL Compare command line interface. I noticed in the GUI version you can specify the output to be in the format of a Visual Studio SSDT project but I couldn't find any documentation on how to do that from the command line. I tried to back my way into that by creating a project through the GUI with the Database Project compatibility box checked and found the options list in the SCP file. One of the options was SsdtCompatibleOptions. But when I use that as part of the options switch from the command line, SQL Compare does not recognize it.

Now, I can still import the script folder generated without the Database Project Compatibility option, but it doesn't import perfectly. In this case, I'm losing some table level extended properties.

Visual Studio doesn't know how to deal with the extended properties when they are scripted like this:
DECLARE @xp char (11)
SELECT @xp=N'08.09.10.01'
EXEC sp_addextendedproperty N'BuildVersion', @xp, 'SCHEMA', N'dbo', 'TABLE', N'MyTable', NULL, NULL

GO

It's easy enough to fix if done one at a time, but, like I said, I'm making a whole bunch and it would be really time-consuming to do this for each table generated by each snapshot.

So, how to I generate an SSDT compatible script folder from the command line?

If it can't be done, is there a way to change the way table level extended properties are scripted? It needs to be usable from the command line, as there are quite a few snapshots I'm trying to convert to SSDT projects and I want to automate as much as is reasonably possible.

Thanks!

Richard

See what crazy things I've been doing with SQL and PowerShell here - https://sqlprogramming.wordpress.com/

Comments

Sign In or Register to comment.