Popular Posts

SQLblog.com - The SQL Server blog spot on the web

Tuesday, August 1, 2017

Auto DevOps

SQLServerCentral » Latest topics
Auto DevOps
Comments posted to this topic are about the item [B]Auto DevOps[/B]

Need to setup a sql alert on “waiting tasks” - similar to “waiting tasks” in Activity Monitor

SQLServerCentral » Latest topics
Need to setup a sql alert on “waiting tasks” - similar to “waiting tasks” in Activity Monitor
My manager has asked me to work upon a request. I am not sure if it is reasonable or weird but he wants me to setup an alert based on the "waiting task" that we see in the activity monitor. Basically, if the value in the "waiting task" goes above 10 then

Who's Smarter? Humans or AI Systems?

SQLServerCentral » Latest topics
Who's Smarter? Humans or AI Systems?
Comments posted to this topic are about the item [B]Who's Smarter? Humans or AI Systems?[/B]

SQL Server geo-cluster 2016

SQLServerCentral » Latest topics
SQL Server geo-cluster 2016

Dear Everyone
Ikeep reading online that its not recommended to virtualize SQL Server clusters (4 nodes)

Are the posted questions getting worse?

SQLServerCentral » Latest topics
Are the posted questions getting worse?
Is it me, or are the posted questions getting worse these days? I just read a post by someone apparently in charge of something who was asking how to take a database backup and restore it on another server. It seems like the general feeling of a lot

Need help in SQL table for updating NULLS

SQLServerCentral » Latest topics
Need help in SQL table for updating NULLS

Find Missing Rows Comparing Two Tables

SQLServerCentral » Latest topics
Find Missing Rows Comparing Two Tables
I have two tables - prod table shows employees and prod id that they are allowed to sell. 
Inv table has invoice numbers and the emloyee name and product.
Each employee eligible to see must be connected to that invoice. 
I want to co

New function and the importance of variables in DAX #dax

SQLblog.com - The SQL Server blog spot on the web
New function and the importance of variables in DAX #dax

I recently wrote a few articles about a new function in DAX and the use of variables. For those of you using Power BI or Azure Analysis Services, you always have access to the latest version of the language. Well, in reality I see that new features appears in Power BI Desktop first, and shortly after in Azure Analysis Services. I’m also working on something that will make it easy to recognize which functions is available in each product/version, but this will still require a few months…

So, what is new in DAX? The SELECTEDVALUE function! It’s only syntax sugar, so you can write:

SELECTEDVALUE ( Table[column], "default value" )

instead of

IF ( HASONEVALUE ( Table[column] ), VALUES ( Table[column] ), "default value" )

You will find more details and use cases in the Using the SELECTEDVALUE function in DAX article I recently wrote on SQLBI. My only concern is that this could increase the use of a bad practice, which is getting the value of the current row after a context transition. Something like:

Company := SELECTEDVALUE ( Customer[Name] )

AvgLength := AVERAGEX ( Customer, LEN ( [Company] ) )

instead of:

AvgLength := AVERAGEX ( Customer, LEN ( Customer[Name] ) )

If you think nobody would do that… yes, you’re right, not for the LEN function. But think again to all the calculations that requires a particular granularity and that you would like to include in a measure instead of a calculated column, and then you will realize that making this mistake is more common that you might think. Yes, in more complex expressions, of course.

The other topic that I covered in two articles is the use of variables, which you will find discussed in:

Defining variables in DAX queries Using GENERATE and ROW instead of ADDCOLUMNS in DAX

The basic idea is that you can simplify the syntax of complex DAX expressions by using variables, and the result you obtain is something that is much more similar to an M script rather than the classic nested sequence of function calls in DAX, as I described in another article, DAX coding style using variables. You can see the benefits of this approach in complex calculations, so this is not something that is very visible in short articles, and it will be the major change of future books and patterns about DAX (which is what I’m working on these days).

SSRS Report Security -

SQLServerCentral » Latest topics
SSRS Report Security -

SSRS 2012  -we have aset of report all using the same data source:&

Who's Licensed?

SQLServerCentral » Latest topics
Who's Licensed?
Comments posted to this topic are about the item [B]Who's Licensed?[/B]

Database Mirroring ( Principle , disconnected)

SQLServerCentral » Latest topics
Database Mirroring ( Principle , disconnected)
Hello All, i have two databases set up as database mirroring on sql server A. connect to SQL SERVER B. every thing was working fine. last night we had windows patching and i paused database mirroring on the database. this morning the database is

Any known issues with in-place upgrade of a 2 node 2012 AG to 2016?

SQLServerCentral » Latest topics
Any known issues with in-place upgrade of a 2 node 2012 AG to 2016?
I have a 2 node, SQL 2012 AG running in asynchronous mode.  I will be upgrading it to SQL 2016 using the rolling method, upgrading the secondary node first, then failing the primary over to it, and then upgrading the new secondary.  Are there an

Comic for 2017.08.01

RSSMix.com Mix ID 8239024
Comic for 2017.08.01
New Cyanide and Happiness Comic

Calculated Query Help

SQLServerCentral » Latest topics
Calculated Query Help
Hi,

I am struggling to grasp on how to calculate in SQL where there is a fixed Qty in stock and minus sales order then it should minus from that QTY in stock where it previously taken off the order qty. I have tried mostly everything but I need h

Should I Re-design table?

SQLServerCentral » Latest topics
Should I Re-design table?
This table has high transactions with select, insert, update, delete and It index got fragmentation about 90% after rebuild 3-4 hour, also deadlock
What should I do with this?