Avoid dropping SQL Server table compression settings - sql-server

I normally use DacFx to deploy and update SQL Server DB defined by DacPac. Sometimes I have to tune up by manually modifying the deployed DB by setting up Compression options on a table level. Is there a way to instruct DacFx to not drop manually added compression options when I ask DacFx to apply a newer DacPac?
There are many "Do not Drop" options, but I don't see there anything related to the Compression:

Related

Duplicate localDB under SQL Servers on my laptop

I've been running into an issue recently when I attempt any tutorials that involve using a SQL database, entity framework, dapper, etc.
When it comes time to publish a database, or utilize an ORM, I'm given duplicate options for the same localdb under SQL Servers. Furthermore, then I attempt to publish, the database doesn't show up under the localdb that I've chosen.
I'm wondering how I go about removing the other SQL Servers and just having the one available.
If you look at the image below, the Browse option gives me two of the same LocalDbs. Plus I also get a 3rd one under \ProjectModels. I'm wondering what's causing this and how it can be fixed since no matter which one I choose, the sql database I attempt to publish doesn't show up within any of them.
My advice is not to use this method to publish the database. (right click to delete)
Please refer to this official documentation.
File-based databases like SQLite or SQL Server Express are designed to store their data in easily transferable files that can be served with your application/site.
"Copy to Output Directory" Property of the database file to "Copy if newer". Just point the address to it.
If you are using a server-based database like SQL Server, MySQL, etc., you need to make sure that the target machine/environment has the same database server installed, and you need to write a deployment script to append the pre-populated data files to the server. This might be troublesome for you.
You can also refer to these links. 1,2,3

Quickly changing SSIS-packages data source parameters for easy migration

I would need to migrate a SQL database from Sybase to MS SQL Server. Before doing the actual migration on the production server I first created an SSIS-package with SQL Server Management Studio's Import/Export Wizard for testing with other databases. The test migration was successful and I would now like to deploy my SSIS-package to the real servers.
However, it seems I cannot simply run the package in Management Studio choosing different data sources for it - it only runs on the same databases for which it was created. Now, it can be edited in something called SQL Server Business Intelligence Development Studio (or BIDS for short)(I am using the SQL Server 2008 version), but going through every data flow task changing the destination source manually for each of the ~ 150 tables I am moving is ineffective and also introduces a possibility for error.
I there a way to quickly change what data source is to be used for ALL destination sources in ALL the flow tasks of an SSIS-package? If not, what simple method is there for testing migration with test databases first and simply changing the data sources when deploying?
I am using ODBC data sources, but for some the package shows OLE-sources in BIDS instead.
I hope I was clear enough. If you have additional questions, please ask! Thank you!
I would use a variable for the ConnectionString property of the connection manager. A package level configuration can be very useful for accomplishing this task. Several ways to do this. I prefer to use a table in SQL Server that holds all the configurations for all packages. This can be especially effective if you have multiple packages and need to dynamically change a set of connection managers across those multiple packages.
The basic steps are:
Opposite click on your SSIS design surface and select "Package Configurations..."
Create a package level configuration of Configuration Type "SQL Server"
Store your connection in a Configuration table in SQL Server
Alter your Connection Manager to use a variable for the ConnectionString Property
Populate that variable from the Configuration table via your package level configuration
When it comes time to switch from Test to Production, simply update the connection string in your configuration table
These screenshots can help...
This is part of a larger package management framework that I implemented using this book:
Microsoft SQL Server 2008 Integration Services: Problem, Design, Solution
I highly recommend it. Should take less than a day to set it up. Book has step by step instructions.
This question and its associated answers also helpful.

How to export database schema in Visual Studio 2012?

I am having a hard time figuring out how to export a database creation script in VS 2012. Is this possible?
It depends on what exactly you mean by your question. If you simply want to generate a create database / tables / views / and optionally include data, then you could use sql management studio (express, if need be) to generate scripts (via SMO) and then simply execute your script at runtime, alternatively i think you can generate scripts from the 'server explorer' tool window if you have a registered SQL server.
However, if you intend to version the database schema, and provide schema versioning/data versioning once a database is in place, they you'll want to look at SQL Server data tier applications, which is more of a toolset and libraries for database lifecycle management (buzzword overdrive enabled).
The tooling for VS data tier app projects is wrapped up in the SQL Server Data Tools, which basically adds a slimmed down version of SQL SMS object explorer to the project window when working with database projects, and adds some pretty awesome project configuration capabilities when compared to just executing a pre-generated SQL script at runtime.
If it's not giving you the update or generate script button, go into schema change options, under the general tab, uncheck "Block on possible data loss". Be sure to compare after changing this option.
Additionally, if you want to retrieve all comments from all tables in your database:
SELECT sys.Tables.Name,Value
FROM sys.Tables
INNER JOIN sys.extended_properties ON sys.extended_properties.major_id = sys.Tables.object_id

Sync LINQ-to-SQL DBML schema with SQL Server database

After creating a SQL Server 2008 database, I made a Linq-to-SQL schema in Visual Studio. Next, in the .dbml visual editor (in Visual Studio 2010), I added PK-to-FK and PK-to-PK associations to the schema.
How do I copy those associations that I created in Visual Studio over to the database? In other words, how do I sync with the DB?
Linq-to-SQL is a great tool, but never ever rely on it to update the schema. Always apply schema changes through upgrade SQL scripts that use DDL CREATE/ALTER/DROP statements to change the deployed schema from the on-disk version to the current version. This way you keep all you schema changes under version control as source text files, you can upgrade from any past version to the current application version and you can easily test all your upgrade paths, including upgrading deployments with very large tables.
The far worse alternative is to use SQL compare tools that can diff your desired schema from your deployed schema, like vsdbcmd. This may work on trivial deployments, but copying and renaming tables of millions of records will quickly show it's ugly downside.
What you absolutely cannot do is rely on the .dbml file as the 'master' copy of your schema. This is a little detail usually omitted by the Linq-to-SQL advocates, one that you discover usually when you attempt to deliver v2 of your application and realize you have no upgrade tool set.

What do all these "Save DTS Package" options mean?

I'm creating a DTS package. After specifying the source, destination, and tables, I get the Save, schedule, and replicate package step, which has a Save DTS Package checkbox.
If I check the box to save, I get these options:
SQL Server
SQL Server Meta Data Services
Structured Storage File
Visual Basic File
Can anyone give a good explanation of what each option means, and the pros and cons of using it to save my DTS package? (Particularly if you have experience with the different options, and aren't just regurgitating something like this.)
These would be your primary options:
SQL Server means in tables in the msdb database
Structured Storage File means a .dts file
The file is portable and standalone. It can be run with dtsrun.exe and does not require a full install to run on an app server.
The msdb option means you need access to the msdb database but you gain backup/restore capability.
It depends on your setup and shop. I prefer the file option, but I'll use either as needed.
I would not use these:
Visual Basic File: once saved you can't edit it again, only run it (and I forgot how now)
SQL Server Meta Data Services: does it still apply?
Some more info on www.sqldts.com but it's not updated now. SSIS has mostly replaced DTS.

Resources