SQL SERVER – Change Fill Factor – SQL in Sixty Seconds #069

“I want to change fill factor to another value – how do I do that?”

The other day I received this question in via Facebook. Fill factor is the value that determines the percentage of space on each leaf-level page to be filled with data. In an SQL Server, the smallest unit is a page, which is made by  Page with size 8K. Every page can store one or more rows based on the size of the row. The default value of the Fill Factor is 100, which is same as value 0. The default Fill Factor (100 or 0) will allow the SQL Server to fill the leaf-level pages of an index with the maximum numbers of the rows it can fit. There will be no or very little empty space left on the page, when the fill factor is 100.

I decided to build a quick video which explains how to change fill factor with the help of T-SQL as well as SSMS.

The code which I have used in this code is over here:

EXEC sys.sp_configure N'fill factor (%)', N'80'
GO
RECONFIGURE WITH OVERRIDE
GO

Action Item

Here are the blog posts I have previously written on the subject of Fillfactor. You can read it over here:

You can subscribe to my YouTube Channel for frequent updates.

Reference: Pinal Dave (http://blog.sqlauthority.com)

About these ads

SQL SERVER – Attach or Detach Database – SQL in Sixty Seconds #068

When we have to move a database from one server to another server or when we have to move a database from one file to another file, we commonly use Database Attach or Detach process. I have been doing this for quite a while as well. Recently, when I was visiting an organization I found that in this organization lots of developers are still using an older version of the code to attach the database. I quickly pointed that out to them the new method to attach the database, however it was really interesting to find out that they really did not know that sp_attach_db is now a deprecated method to attach the database. This really made me to do today’s SQL in Sixty Seconds. I demonstrate in this SQL in Sixty Seconds how to attach or detach the database using a new method of attaching database.

The code which I have used in this code is over here:

-- Detach Database
USE [master]
GO
EXEC MASTER.dbo.sp_detach_db @dbname = N'AdventureWorks2014_new'
GO
-- Deprecated Way to Attach Database
USE [master]
GO
EXEC MASTER.dbo.sp_attach_db 'AdventureWorks2014_new',
'E:\AdventureWorks2012_Data_new.mdf',
'E:\AdventureWorks2012_log_new.ldf'
GO
-- Correct Way to Attach Database
USE [master]
GO
CREATE DATABASE [AdventureWorks2014_new] ON
( FILENAME = 'E:\AdventureWorks2012_Data_new.mdf'),
(
FILENAME = 'E:\AdventureWorks2012_log_new.ldf')
FOR ATTACH
GO

Here is the question back to you – Do you still use old methods to attach database? If yes, I suggest that you start using the new method onwards.

SQL in Sixty Seconds Video

I have attempted to explain the same subject in simple words over in following video.

Action Item

Here are the blog posts I have previously written on the subject of SA password. You can read it over here:

You can subscribe to my YouTube Channel for frequent updates.

Reference: Pinal Dave (http://blog.sqlauthority.com)

SQL SERVER – Contest Winner – What Next on SQL in Sixty Seconds – Poll Result

A few days ago, I have asked a question on this blog. The question was – What would you like to see in the next episodes of SQL in Sixty Seconds. The poll is still active and posted over here: SQL SERVER – Poll – What would you love to see in SQL in Sixty Seconds? The contest was to suggest the next item of SQL in Sixty Seconds and vote for the your choice of subject. There have been plenty of votes to this contest, however, there were only 4 comments to this blog post. Hence, selecting a winner was very simple.

Result of Poll

It is very clear from result, most of the people would like to watch Performance Tuning subjects. I will continue to build video on this subject in future.

Contest Winner

Now is the time for the winner of the contest, who left comments on the blog. The winner is Raelyard. Here is the comment which he has left on the blog.

raelyard please reach out to me via email and I will send you the gift card.

Current Contest

Here is the contest which is currently running on this blog. You can take part in the contest and can win a Drone.

SQL in Sixty Seconds

Here are few of the episodes of SQL in Sixty Seconds, which you can watch. We will have more episodes of SQL in Sixty Seconds from next week which are focused on performance.

Reference: Pinal Dave (http://blog.sqlauthority.com)

SQL SERVER – Copy Database – SQL in Sixty Seconds #067

There are multiple reasons why a user may want to make a copy of the database. Sometimes a user wants to copy the database to the same server and sometime wants to copy the database on a different server. The important point is that DBA and Developer may want copies of their database for various purposes. I copy my database for backup purpose. However, when we hear coping database – the very first thought which comes to our mind is – Backup and Restore or Attach and Detach. Both of these processes have their own advantage and disadvantages. The matter of the fact, those methods is much efficient and recommended methods.

However, if you just want to copy your database as it is and do not want to go for advanced feature. You can just use the copy feature of the SQL Server. Here are the settings, which you can use to copy the database.

SQL in Sixty Seconds Video

I have attempted to explain the same subject in simple words over in following video.

Action Item

Here are the blog posts I have previously written on the subject of SA password. You can read it over here:

You can subscribe to my YouTube Channel for frequent updates.

Reference: Pinal Dave (http://blog.sqlauthority.com)

SQL SERVER – Poll – What would you love to see in SQL in Sixty Seconds?

Last week, I had my very first SQL in Sixty Seconds Video of this year. Lots of people send me email asking for me to continue this series as it was extremely fun at times to watch the video. I am going to start the series again in the month of June. However, I need your help to decide what would like to see in SQL in Sixty Seconds Videos.

Here are quick poll and I requesting you to help me with the poll.

Contest 

If you leave a comment to this blog post and if I build a SQL in Sixty Seconds Video on it. I will send you a surprise gift (worth USD 25).

Earlier Videos

Here are few of my previous SQL in Sixty Seconds Video. Please check them out they should give you an idea what I usually cover in Sixty Seconds.

Reference: Pinal Dave (https://blog.sqlauthority.com)

SQL SERVER – Reset SA Password – SQL in Sixty Seconds #066

It has been quite a long time since I posted SQL in Sixty Seconds Video. Here we are back with the new video.

One of the most popular question, I often receive is very similar to following:

“How do I reset the password for SA username?”

“I have forgotten the SA password, what should I do?”

“Our DBA just left the job and now noone knows how to reset the SA password. Please help.”

Solution

Honestly, it is pretty simple to reset the password for SA username. You just have to login to the system where your SQL Server is installed. Open SQL Server Management Studio and login with the help of Windows Authentication. As local system is the admin of the SQL Server, you will get access with administration privileges. Now, open the database, expand Security >> Login folder and right click over SA username. Now, it will bring up the screen where you can change the password for SA.

SQL in Sixty Seconds Video

I have attempted to explain the same subject in simple words over in following video.

Action Item

Here are the blog posts I have previously written on the subject of SA password. You can read it over here:

You can subscribe to my YouTube Channel for frequent updates.

Reference: Pinal Dave (http://blog.sqlauthority.com)

SQL SERVER – How to Install SQL Server 2014 – A 99 Seconds Video

Last month I presented at 3 community and 5 corporate events. Every single time I have been asked by others what is my experience with SQL Server 2014. Every single time I have told the audience that they should try this out themselves, however, the response has been very lukewarm. Everybody wants to know how SQL Server 2014 works, but no one wants to try out themselves.

Upon asking why users are not installing SQL Server 2014, pretty much the same answer I received from everyone – “The Fear of Uknown”. Everybody who have not installed SQL Server 2014 are not sure how the installation process works and what if they face any issue while installing SQL Server 2014. If you have installed an earlier version of SQL Server, installing SQL Server 2014 is very easy process.

I have created a quick video of 99 seconds where I explain how we can easily install SQL Server 2014. This is a straight forward default installation of SQL Server.

Reference: Pinal Dave (http://blog.sqlauthority.com)