Skip to main content

Posts

Renaming SQL Server Database

Very recently I was working on a data archival module. Project was almost 10+ years old and it kept very sensitive, huge data set. While testing this, accidentally I have deleted some required records from a shared development database which is not awesome at all. Only option that I had was restoring backup files. But developers who worked with me requested to keep the damage database, since they were not sync schema with the source controller. Only possibility that came to my mind was rename the damaged database and restore backup database with the original name. As all ways I googled it "how to rename a SQL server database", many articles were listed down in my search result but couldn't find a good all in one article. therefore thought of sharing what I learned. Understanding what we are going to do with the rename is important.Mainly this process can divided into three parts, Rename Database Rename Mappings Rename Files Following the order of above thre...

SSAS: Picking The Right Data Types For The Measures

Symptoms You don't see what you expect to see. As an example, you get a negative amount for aggregation in an INT type Measures even though it only contains positive values. To explain this I'll take above mention example. Cause This is most likely caused by the capacity insufficiency of INT data type. Resolution Update Measures' data type to BIGINT (Since that will be the  next large best datatype for INT ). Into the Depth When the data warehouse fact table contains records like below, Record # Amount Month_Key Year_Key Record 1 500000000 2016/Jan 2016 Record 2 500000000 2016/Feb 2016 Record 3 500000000 2016/Mar 2016 Record 4 1000000000 2016/Apr 2016 Record 5 1000000000 2016/May 2016 Record 6 100000000 2016/Jun 2016 Record 7 500000000 2016/Jul 2016 Querying amount for each month will show positive values  The amount for Janu...

SSAS: The Sort Order Specified For Distinct Count Records Is Incorrect.

Symptoms During a processing time of a cube that contains a distinct count measure, the process fails with the following error message: The sort order specified for distinct count records is incorrect Cause This is most likely caused by different sort order used on the data warehouse data set and the analysis service database data set. Resolution Modify the sort order of the data warehouse data set so that it will match with the analysis service database data set. Into the Depth  Navigate to the analysis database and start to process the desired database. When the processing begins, the Process progress window will pop up. Wait till the process gets failed. After the process failed, find the failing measure group and expand to the last node where you can see an SQL query. Double click on the query and view the details. This query gives you the exact order by the column which caused you this trouble.  Execute the query using the data warehouse datab...