Archive for the ‘Sql Server’ Category

Hello Friends one requriment face last days from my boss was he said me that get all active connection in any database in sql server. mean give me list of all user which are currently connected to the our live database.

so fullfill this requriment with below solution so please write this query it will make your boss happier also

this query is for all database on server.

SELECT db_name(dbid) as DatabaseName, count(dbid) as NoOfConnections,
loginame as LoginName
FROM sys.sysprocesses
WHERE dbid > 0
GROUP BY dbid, loginame

please tell your boss and get increment in your salary.

Hello Friends many People install sql server 2005 and then after they want to change system admin password mean “sa” password.

i give you two way to change “sa” password one is if you don`t know the password then do following stuff in your query window.
ALTER LOGIN [sa] WITH DEFAULT_DATABASE=[master]
USE [master]
ALTER LOGIN [sa] WITH PASSWORD=N’NewPassword’

Second Way is you may be  remember your Old Password and want to change the ’sa’ password then do following stuff.

ALTER LOGIN [sa] WITH PASSWORD = N’MyNewPassword’ OLD_PASSWORD = ‘MyOldPassword’;

Enjoy Boys and Girls.