Skip to main content

Posts

Showing posts from 2017

MicroStrategy: Event Triggered Intelligent Cube Refresh

I recently had a need to trigger Intelligent  Cube refresh based on a certain event. That certain event was ETL completion. My ETL writes begin and end times to a log. I could easily have a service run that would periodically monitor the log and refresh the Intelligent Cube. That seems to be too much of an overhead when I can simply call the Command Manager to execute the cube refresh from the ETL. Image Source: https://www.rubiks.com/solve-it/3x3 You will need to create a MicroStrategy Event, MicroStrategy Schedule, schedule Intelligent Cube Refresh, create Script file, create Batch file and that pretty much sums it all! Create an Event Select New, Event and name it – Events are an empty object - as in they do not do anything, it is just an empty shell. Call this event a proper name. In my case, it is aclled Batch Cube Refresh - Short Form. Create a Schedule that uses the new Event Select New > Schedule Name the schedule, in my case 'Batch

SQL SERVER – Puzzle – Write a Shortest Code to Produce Zero

Originally Posted by: Pinal Dave @ SQLAuthority https://blog.sqlauthority.com/2017/08/24/sql-server-puzzle-write-shortest-code-produce-zero/ Image Source: https://fr.fotolia.com/tag/quiz Pinal Dave is someone whose blogs I've followed for years, probably almost a decade. He has posted a puzzle on his website. If you know the answer, head over to the site, link above and respond! Puzzle : Write a Shortest Code to Produce Zero Conditions 1. Do not use numbers and arithmetic calculation 2. Do not use the function 'LEN()' 3. Do not use 0 in the code 4. Length of the entire code should be less than 19 characters Good Luck!

Scripting ALL ForeignKeys At Once!

I have a pretty extensive ETL in place involving a ton of tables. To improve performance and keep the transaction log clean, I recently decided to TRUNCATE a bunch of tables instead of DELETE. Unfortunately, Now, I was unable to truncate data as these tables are a part of foreign key based referential integrity in MS SQL. No love lost. I started scripting one FK at a time and saving them in two separate files, DROP_FK.sql and RECREATE_FK.sql. After doing about five of them at 11pm, I realized that this was going to be a painful task. A light bulb went off - why not use the system tables; they surely have all of this information stored somewhere! After a bit of research, I came up with the below query. There are many other queries (probably more robust than mine) out there on the interwebs! Please do your research. Without further ado, here is my query. Database: any Tables: sys.tables       sys.schemas       sys.foreign_keys       sys.columns       sys.foreign_key_columns