How to attach/detach a database without Enterprise Manager?

Introduction: Due to various reasons it can be possible that the Enterprise Manager cannot be used to attach/detach a database in SQL. For example when the MSDE version of SQL is used, the Enterprise Manager is not available. In this case MS-Dos can be used to attach/detach the database. Explanation: In order to attach/detach a database via MS-Dos follow the steps below: Go to [Start] [Run] and type CMD followed by [Enter] type cd [Enter] to go to the root C: type osql -E [Enter] now, 1> will appear. The commandline can now be entered. Attach a database: In the […]

Read more

Error: Another Version of Microsoft Visual Studio 2008 has been Detected on this System that must be Updated to SP1

Symptoms While attempting to install the SQL database and management tools from Microsoft on Windows 2008 R2 server that has XenApp 6.0 or later version installed, the following error message appears: “Another version of Microsoft Visual Studio 2008 has been detected on this system that must be updated to SP1. Please update all Visual Studio 2008 installations to SP1 level, by visiting Microsoft update.” The following table provides information about where the installation of SQL 2008 database and management tools fails. Machine Type SQL 2008 database and management tools: Install XenApp Installed, Configured on Windows 2008 R2 using SQL Express […]

Read more

How to kill all sessions that have open connection in a SQL Server Database?

As SQL Server DBAs, many times we need to KILL all Open Sessions against the SQL Server Database to proceed with Maintenance Task, Restore and more… You can use below different techniques to KILL all open sessions against the database. Technique – I Here we will query the SysProcesses table to get the session running against the user database and prepare the dynamic SQL statement to KILL all the connection. view source print? 01 DECLARE @DbName nvarchar(50) 02 SET @DbName = N’Write a DB Name here’ 03   04 DECLARE @EXECSQL varchar(max) 05 SET @EXECSQL = ” 06   07 […]

Read more