Analysis Services Dimension members - change permission by script - scripting

How can I change custom access to dimension data for some role using scripts or XMLA file or some .net code without UI such as SQL Server Management Studio or Business Intelegence Developer Studio?
The goal is to have ability to change permissions from another application via web-interface or some bat file etc.

Yes. You can automate role setup with AMO like this article shows:
https://bennyaustin.wordpress.com/2011/05/24/ssas-using-amo-to-secure-analysis-service-cube/
But you might also consider dynamic security before you try another approach:
http://hccmsbi.blogspot.com/2007/08/implementing-user-specific-security-in.html

Related

Is it possible to change default ComputeModel for create database with Azure SQL Server

I tried to create a database in Azure Sqlserver. "CREATE DATABASE" SQL command works. But it use default "General Purpose" as ComputeModel. Is it possible to use other option as default one.
I found the power shell command: New-AzSqlDatabase which I could use to create database with give ComputeModel. But I do not want to that way.
My target is: System admin define the default template such as ResourceGroupName, ComputeModel, MinVcore, MaxVcore etc... And developer or DBA could run SQL Command to create database without touching Azure setting at all.
Is there anyone could give me some suggstion?
Thanks.
With the latest Gen 5 hardware in place, we are making a change to the default database configuration and the default elastic pool configuration for all new Azure SQL databases. Starting May 31, 2019, the default configuration will be a General Purpose 2 vCore database or elastic pool provisioned on Gen 5 hardware.
In SSMS, you can edit the script to create new database with the price tier which you specified.
Fore details, please reference this tutorial: Script objects in SQL Server Management Studio
This tutorial teaches you to generate Transact-SQL (T-SQL) scripts for various objects found within SQL Server Management Studio (SSMS). In this tutorial, you find examples of how to script the following objects:
Queries, when you perform actions within the GUI
Databases in two different ways (Script As and Generate Script)
Tables
Stored procedures
Extended events
To script any object in Object Explorer, right-click it and select the Script Object As option. This tutorial shows you the process.
Hope this helps.

How to create Copy of Clone Database for N Number of Clients in SQL

How to create copy of clone database for N Number of clients dynamically in sql.
The requirement is as below.
i am having a super admin database which is specific for super admin role alone and if any new client comes the super admin will get those client information and saves it.
During the Save process i need to create a copy of database for the client with the client information provided.
As same continues for N number of clients..
How to workout this logic dynamically with the existing tables.
Create a Visual Studio SSDT (SQL Server) project - you can use visual studio express if you do not have visual studio already.
Import your table schema and if you have any reference data add it to a post deploy script.
Build the project and you will have a .dacpac.
When you want a new database, from a command prompt do:
sqlpackage.exe /Action:publish /sourcefile:path\to\dacpac.dacpac /TargetServerName:Server /TargetDatabaseName:%NEWDATABASENAME%
You can wrap the call to sqlpackage.exe in a batch or powershell script to make it simpler.
If you want to do it from a .net program you can call thed DacFx api directly (http://blogs.msmvps.com/deborahk/deploying-a-dacpac-with-dacfx-api/)
Good luck!
Ed

Can't create database in SQL SSAS

I installed Microsoft SQL Analysis Service because I need it to run a forecast analysis from Excel using the Data Mining Plug-in.
When I open MS Management Studio and connect to the SSAS I don't know how to create a new database.
When I right-click over Databases there is nothing like Create Database or New Database.
This is the image of my problem:
Well... I solved my problem reinstalling the suite selecting all of its options.
I still don't know what may cause this problem if not chosen in the instalation options but now I have the New Database option and could finish my job.
Thanks.
I managed to solve this problem by switching Analysis Services from Tabular to Multidimensional mode:
Stop SQL Server Analysis Services service
Go to the config folder, e.g. C:\Program Files\Microsoft SQL Server\MSAS15.SQL2019\OLAP\Config
Copy file msmdsrv.ini to another folder (you can't edit it here directly)
Open the copied file and search for the DeploymentMode xml tag
Set the value to zero
Save the file, copy it back to the Config folder
Start the service
You can use SQL Server Management Studio to create a new, empty database on an instance of SQL Server Analysis Services.
To create an Analysis Services database
Connect to an Analysis Services instance.
In Object Explorer, expand the node for the connected Analysis Services instance.
Right-click the Databases node of the Analysis Services instance and select New Database.
In the New Database dialog box, in Database name, type the name of the new database.
In Impersonation, provide impersonation information for the new database.
In Description, type the optional description for the new database.
Click OK.

Visual Studio 2010 C# - application with centralized database - development

I've started working on my database desktop application. The goal is to have one centralized database, so that each employee could connect.
My goals:
Centralized database on SQL Server 2008 Express
Use Sql to Linq
First run of application should create structure of database on server.
Now my question: how to do the last point?
I know that I can generate sql script via SQL Managment Studio and then execute it, but maybe there is some better way?
Like the comments said, I'm not sure why you would want to do this, but if you have one centralized database machine and you want to create a new database per user upon the first connection, then you could create one canonical/template database and the clone it via scripting on the first connect.
Your UI would say something like "Please wait while we create your new database..." and you'd run CREATE scripts for the database/tables/stored procedures/views/etc.
Just remember it might be a major pain to update the schemas of these databases once the cat is out of the bag.

Automatic incremental SQL Script generation for incremental, nightly builds when using Team Build in TFS 2008 and Visual Studio 2008?

hope that everybody here is OK.
We are using VS 2008 as development tool, TFS 2008 as version control as well as build automation. Some of our developer use dbpro for databases changes and some use SQL Server management studio.
I am trying to automate build for Web Application built using C# and VB.Net.
Our scenario is such that we have a central database to which our web application connects.
Whenever we supply our clients with a new functionality or a bug fix, we supply them incremental builds.
The SQL script is checked into source control for every incremental build when they have made and tested there changes on our central DB Server.
I want to generate Differential script that can be run at the client as an incremental update script. Now to come about it is a problem. Sometimes our developers tend to forget the database change-sets and the script in the source control is missing an SP or a two.
Also, sometimes we need to insert default data into some of the tables that have strict stringent values and not test values. Like a table that contains Services provided by the panel, we add a new service name, signature, credentials and service address, etc etc in the ServiceTable. Besides this many other tables may have test data that may not be needed.
If we use DataCompare, it will generate changeset for required data (important for client to enable certain services) and our test data that was added to the database as a result of our testing of the functionality or bug fix.
Currently i am using SQLSchemaCompareTask (from Visual Studio 2008 Team Database Professional Power Tools API) in the TFSBuild.proj file of the build definition for TFS 2008.
Using SQLSchemaCompareTask, the script generated contains database names like [dbo]. etc which are not desired as the script fails when run against SQL Server 2000 databses (Some of our client still use SQL Server 2000) databases as teh backend of the application.
Also default data can't be generated by this process.
To overcome this problem, i have to come up with a solution that can compare databases and generate script automatically that does not have to be manually reviewed again before being sent to the client.
Please suggest effective methodology of such SQL script generation and suggest whether two different databases may be used or something ? Is there any toolkit or api that can enable build automation for SQL Server databases?
Thank you all.
Regards
Steve
Try to use SQL Examiner Suite for this:
http://www.sqlaccessories.com/SQL_Examiner_Suite/
The tool compares both schema and data and produces synchronization scrips (or differentials scripts). You can automate script creation with supplied command-line tool.
Rather than collating many individual change set scripts (and therefore occasionally missing objects out), why not use schema compare and data compare to create a single script from your database project using a database equivalent to your client's on the target? This should create a script tailored to their requirements.
In data compare you can exclude test data records that you don't want pushed to your client by unchecking them in the lower grid.