Monday, July 19, 2010

SQL Server Service Packs and Versions

What is my SQL Server version ? Which Service Pack currently installed ?
You could find the answer yourself. Just use this command : SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY ('productlevel'), SERVERPROPERTY ('edition').
And Voila!!! the answer appears right in your face.




Login with DAC (Dedicated Administrator Connection) Mode in SQL Server 2005

Sometimes you'll need to login into SQL Server with DAC (Dedicated Administrator Connection) mode. Here is the quick way to do that :
1. Stop SQLServer(MSSQLServer) service.
2. Right click in the SQLServer(MSSQLServer) service and choose properties.
3. When the service is stop, you could insert service parameter in the properties page. In this case you should fill the parameter with '-m'.
4. Start the service again without closing the properties page.
5. Open SQL Server Management Studio, just press cancel when it ask for login information.
6. Choose 'New Query' button, or by pressing 'Ctrl+N'
7. It should ask you for login information again, fill it with your 'sa' account. but in server name your should fill with this format : ADMIN:[YourServerName]
8. Then press OK.
9. You should now in DAC Mode

Change SQL Server Name

In case you need to change your server name, you could use this tips so SQL Server will still run smoothly after you change your server name.
For example you need to change your server name from 'ServerA' into 'ServerB', firstly drop the old server name with this command : sp_dropserver 'ServerA'.
After that, you should add your new server name with this command : sp_addserver 'ServerB','local'.
Parameter 'local' in this command means that this server is local server, not other linked server.
To check your current server name, you could use this command : SELECT * FROM sys.servers.
If you do all the things right, you should see your server listed there.