Category: SQL Server

Truncate Logfile in SQL Server

Using the code Step 1. Copy/type the below given SQL. Step 2. Change @DBName to < Database Name>, @DBName_log to <Log File Name> Step 3. Execute the SQL. ALTER DATABASE @DBName SET RECOVERY SIMPLE WITH NO_WAIT DBCC SHRINKFILE(@DBName_log, 1) ALTER DATABASE @DBName SET RECOVERY FULL WITH NO_WAIT GO In SQL Server data is stored using…




SQL SERVER – Enable xp_cmdshell using sp_configure

They good old backdoor called xp_cmdshell is – and that’s absolutely ok – disabled by default starting Microsoft SQL Server 2000+. To re-enable that feature, there’s a stored procedure available called sp_configure….




SQL Server 2008: Error Saving changes is not permitted

If you have been playing with SQL Server Management Studio 2008 and are modifying tables in the designer, you may run into this error: Save Saving changes is not permitted. The changes you have made require the following tables to be dropped and re-created.  You have either made changes to a table that can’t be…



SQL: List Database Connections for specific user

Want to list all connections to a database for a specific user? go read on..  …



SQL: Drop / Kill Database Connections

If you need to drop database connections for a specific database, go read on.. This has been tested for Microsoft SQL Server 2005 and Microsoft SQL Server 2008….



SQL how to attach a database / DB using osql.exe

This is a quite simple task .. Assuming you have an MDF file called cxnMassImport.mdf and you want to attach it using osql.exe. Open a CMD Type: osql.exe -E -S .\SQLExpress…



How to: Change the Default Login Authentication Mode to SQL

How to Change the Default Login Authentication Mode to SQL short description: use SECURITYMODE=SQL as command line setup parameter when installing SQL Server or change one of the following registry keys: Default instance: HKLM\Software\Microsoft\MSSqlserver\MSSqlServer\LoginMode Named instance: HKLM\Software\Microsoft\Microsoft SQL Server\ Instance Name\MSSQLServer\LoginMode to 2 for mixed-mode or 1 for integrated security. (Integrated is the default setup…



Solution: SQL Server Enterprise Manager General OLE Error 16386

Tried to start Microsoft SQL Server Enterprise Manager and got stuck at the error message General OLE Error 16386: try this, maybe this solves the issue.. a. Stop all SQL Server services (MSSQLServer, SQLServerAgent, MSSEARCH) b. Open command prompt and go to the %ProgramFiles%\Microsoft SQL Server\80\Tools\Binn directory c. Unregister the following .dll files (Ex. regsvr32…