Installing .NET 3.5 Framework in Windows Server 2008 R2

This article will guide through the steps to install .NET Framework 3.5 on a Windows Server 2008 R2.

I recently installed and started working on a Windows Server 2008 R2 Enterprise. I started installing SQL Server and I knew SQL Server 2008 requires the Microsoft .NET Framework 3.5 to be installed on the machine. The installation wizard displayed the following message box (picture below), which is common. (as I had previously installed SQL Server 2008).

I clicked OK button and the setup started loading the required components and immediately displayed the error message (picture below), asking to install .NET Framework from Role Management Tool.

To install roles on a Windows Server the roles have to be added in the Server Manager. So I opened the Roles node from the tree structure in the Server Manager and what you see below is what it looks like (only required portion of the screen is shown to make the images smaller and tidy). On the right side, Add Roles is available and we need to select / click that.

Upon selecting Add Roles, the Add Roles Wizard is displayed as shown below. I selected Application Server and on selecting it, there is a description available on the right side, what that role is going to provide or include.

The following information message box is displayed informing that to install an Application Server, there are certain other required features we need to include. All we need to do is to click the Add required features button in the message box.

It would then display the dialog box giving a short information of what an Application Server does. Click Next to continue.

I choose some additional roles apart from Application Server role, and the dialog box below is a confirmation of all the selections, click install to start the installation process.

The Installation begins. (Picture Below)

The installation is successful and the picture below is the dialog box confirming the success of the installation of the roles that we have chosen.

With that, the prerequisite for installing a SQL Server 2008 Instance is met, and we can continue installing SQL Server 2008.

Do you like this site? Like our FB page @ Facebook.com\LearnSQLWithBru that let’s you know when there is a new blog post.

–Bru Medishetty

Linked Server with Access 2007 Database

This article will explain the steps to create and using a Linked Server on an Access 2007 Database. The steps include creating a Linked Server using GUI and through T-SQL script.

The picture below displays location of the 2 Access Databases (My Documents directory) used in this exercise.

To create a Linked Server using the New Linked Server dialogs, start at the Server Objects in the Object Explorer in SSMS. Expand Server objects and on the Linked Servers, right click and select New Linked Server. (Picture below)

In the New Linked Server dialog box, type the linked server name that you would like to create and use (It is
not a must to have the actual name of the Access database, in the example we are naming
LINKEDSERVER_ACCESS
. For Server type, choose Other data source, and for Provider from the drop down
list, choose Microsoft Office 12.0 Access Database Engine OLE DB Provider.

For the Product Name, type ACCESS and for the data source give the location where the access database is located. (Picture below)

After entering above mentioned details, select the Security Page in the left hand pane of the dialog box. In the security settings choose the option Be made using the login’s current security context. Click Ok and the Linked Server is created.

The picture below displays the query to update a table and select statement to retrieve the table data.

Alternately you can add a linked server using the system stored procedure sp_addlinkedserver in the Master DB. The picture below shows the parameters for the stored procedure such as servername, srvproduct, provider and the datasource. After adding the Linked Server, the next query is a select statement to select few records from the newly created Linked Server.

 Do you like this site? Like our FB page @ Facebook.com\LearnSQLWithBru that let’s you know when there is a new blog post.

–Bru Medishetty

View SQL Server Error Logs through T-SQL

When SQL Server error log is not initialized at a regular interval causing the error log file to grow into a huge file. Viewing that in the SQL Log File Viewer would be a time consuming task. 

This article will show how to view the SQL Server error log from a query analyzer in 2000 or query editor in later versions. As an additional benefit this code filters the log file and displays only the past 24 hours (default code). 

To view SQL Server error logs in SQL Server 2000

DECLARE @HOURS INT
SET @HOURS = 24

CREATE TABLE #ErrorLog
(ErrorLog Varchar(1000),
ContinuationRow INT)

INSERT INTO #ErrorLog
EXEC sp_readerrorlog

DELETE FROM #ErrorLog
WHERE
(LEFT(LTRIM(ErrorLog),4)
NOT LIKE DATEPART(YYYY,GETDATE())
AND ContinuationRow = 0)
OR ContinuationRow = 1
OR LEN(ErrorLog) < 25
OR
(CAST(LEFT(LTRIM(ErrorLog),23) AS DATETIME)
< CAST(DATEADD(HH,-@HOURS,GETDATE()) AS VARCHAR(23)))

SELECT * FROM #ErrorLog 

DROP TABLE #ErrorLog

To view SQL Server error logs in SQL Server 2005 / 2008 / 2008R2

DECLARE @HOURS INT
SET @HOURS = 24

CREATE TABLE #ErrorLog
(LogDate DateTime, ProcessInfo Varchar(50),
[Text] Varchar(4000))

INSERT INTO #ErrorLog
EXEC sp_readerrorlog

DELETE FROM #ErrorLog
WHERE LogDate < CAST(DATEADD(HH,-@HOURS,
GETDATE()) AS VARCHAR(23))

SELECT * FROM #ErrorLog 

DROP TABLE #ErrorLog

The script can be changed to display only data for the past n # of hours by changing the value of @Hours.

Do you like this site? Like our FB page @ Facebook.com\LearnSQLWithBru so that, you know when there is a new blog post.

Bru Medishetty