Showing posts with label SQL. Show all posts
Showing posts with label SQL. Show all posts

Apr 17, 2016

Business Intelligence - The Intro

BI Dashboard examples (Click to Enlarge)
Business Intelligence does not have a formal definition but the term is used for a variety of tools and activities used to analyze raw data and present it in a more meaningful and useful format for business analysis purposes.

The term Business Intelligence has been abbreviated to BI and is used alternatively. We will stick to using the abbreviated form BI for representing Business Intelligence in all our Articles, Blogs, Guides and Forums.

BI provides current performance status in relation to past performance and predictive  future views, and provides the target users (business leadership) the ability to modify (slice and dice) and dive deeper (drill down) or summarize (drill up) information. The data becomes even more useful when a comparison to industry specific benchmarks is incorporated.

BI helps organizational leadership to make informed decisions and take calculated risks in both operational and strategic spheres. KPI's can be established and performance can be measured against those. Performance Indicators breaching preset thresholds utilizing easy to read and at-a-glance visuals, can lead to further digging (slicing/dicing and drilling) into the data.



BI information is generally represented as Dashboards, which are collections of related visuals and reports, providing an at-a-glance . Raw data is converted into an OLAP cube. OLAP stands for Online Analytical Processing, which may be defined as a computer based technique for analyzing data and providing insights. Cube is used to define a mutli-dimensional data sets. traditionally a data set has two dimensions , rows and columns. OLAP cubes have more than two dimensions and those with more than three dimension are also sometimes refer to hypercubes. The advantage of cubes is the data is pre-processed and readily available for slicing, dicing and drilling, saving time compared to running queries in real-time against traditional relational data sets.

Apr 11, 2016

NULLs in SQL results Export to EXCEL


Image result for ssmsI was working on a project to export some data into a tab delimited file. Initially, we did some test files and it was simple enough to use a select query and export the results to a text file by right clicking the top left box of the results pane. However, the recipient indicated that the file had NULL columns with the text string 'NULL' in them which interfered with their processing. They requested us to remove the NULL string and instead pass on these fields as blank. I found a free tool called FnR, for Find and Replace, which replace text strings with whatever value is specified. It was all working fine till they asked us to send a full file with more than half a million records. FnR refused to work and would time out. I generated a command line command, another useful feature built into FnR, and tried that, but no joy. So i went to my trusted friend Google and asked for solutions. I found that this has been a very common issue and many people had asked for a solution, only t get lectures on what they are doing wrong and long debates of what DBAs and Analysts  deemed best practices. Some workable solutions were also discovered in the process, but when dealing with a large number of fields it becomes impractical to use REPLACE or COALESCE commands with every field to check if it contained a NULL and then replace it with blanks. While the debate lingered on from forum to forum, the person asking the question would eventually bail out due to frustration without getting a proper solution to their problem. I did however came across one suggestion that wasn't given much attention of using the query to export the results to text, rather than the right click process I was following. I decided to give it a try and, viola, no more NULL strings.