I was doing some work on SSRS (SQL Server Reporting Services) recently, and found that some of the features were not working as they should. I use IE (Internet Explorer) to do my report management functions, but for some reason, I was not able to see drop down lists or certain menu items.
I was checking my settings and then I suddenly remembered that an automatic update had kicked off on my laptop. I checked and found that this auto update upgraded IE from version 9 to 10. Now IE 10 for some reason does not support all the features of SSRS! I was using 2008 R2.
The good news is that there is an easy fix to this situation. Open up IE and hit the F12 key to open up the developer tools (also available under the tools menu). A developer window will open up on the bottom of the IE screen. Click on the Browser Mode: IE10 menu item and select IE 9. Your browser window will be refreshed and you should have all the features of SSRS back to how they were.
Two terms that used to define an index’s weight/quality are: selectivity and density. I have come across these terms many times and assumed their meaning which was mostly right. To end those assumptions and have a proper explanation, see the example below:
In a company with 1,000 employees, an index on Date of Birth would likely be highly selective—meaning that a query for employees born on a given day should, statistically, never return more than an average of 3 or 4 employees per day. In SQL Server terminology, this index would have a density of .003% (or 3 out of 1,000), which in turn, would translate to an index selectivity of .997 (index density and selectivity are inversely related or proportional.) Essentially, this index would be beneficial in any query used against the birth date of employees, as the data within this index is ‘selective’ or capable of discriminating against different types of results. Within SQL Server, the more selective an index, the greater the chance that it will get used, and the more efficient it will be at returning results in a performant manner.
Full credit for example goes to an excerpt from a whitepaper by Michael K. Campbell
TOP 10 SQL PERFORMANCE BOOSTERS
INCREASE SQL SERVER PERFORMANCE
WITH THE HARDWARE YOU ALREADY OWN
BY MICHAEL K. CAMPBELL
I am going back to the basics here. I realized that in my quest for learning advanced topics, I tend to get a bit rusty with the basics. Hence I am creating a new a new basics tag for my posts and will be creating very basic posts with this tag.
Foreign key (FK) constraints allow you to create relationships between two tables. One of the tables will be treated as a parent table and the other table will be treated as the child. The FK constraint will connect one column from the parent with one column of the child.
-- Creating the parent table and adding constraints. CREATE table parent ( id int identity, value int ) alter table parent alter column id int not null alter table parent add constraint pk_parent_id primary key (id) -- Creating the child table and adding constraints. CREATE table child ( id int identity, parent_id int, value int ) alter table child alter column id int not null alter table child add constraint pk_child_id primary key (id) alter table child add constraint fk_child_parent_parent_id foreign key(parent_id) references parent(id)
You cannot delete a row from the parent table, if there is a related row in the child table. You can delete rows from the child table without issues.
-- Inserting a row into the parent table and a related row into the child table. insert into parent VALUES (20) INSERT INTO child(parent_id,value) VALUES (1,10) -- Trying to delete the previously inserted row from the parent will give an error. delete FROM parent where id=1 Msg 547, Level 16, State 0, Line 1 The DELETE statement conflicted with the REFERENCE constraint "fk_child_parent_parent_id". The conflict occurred in database "dba", table "dbo.child", column 'parent_id'. The statement has been terminated.
You cannot insert a row into the child table’s column (that is restricted by the foreign key) if that value does not exist in the parent table. You can insert rows into the parent table without issues.
-- If there is no value in parent.id = 111, the row below will error out. INSERT INTO child(parent_id,value) VALUES (111,10)
Msg 547, Level 16, State 0, Line 1The INSERT statement conflicted with the FOREIGN KEY constraint “fk_child_parent_parent_id”. The conflict occurred in database “dba”, table “dbo.parent”, column ‘id’.The statement has been terminated.
To delete rows from the parent table, you can use a cascade on delete. Another manual method is to delete all the referenced child rows and then to delete the parent row. The similar restrictions apply for updating rows to the related tables.