You can follow the below steps to change the password of the logged in account using RDP.
Step 1: Go to Start -> Windows Security
Step 2: Click on change password
Step 3: Change the password as mentioned in the below screen.

All Articles
Posted by Jugal Shah on May 23, 2012
You can follow the below steps to change the password of the logged in account using RDP.
Step 1: Go to Start -> Windows Security
Step 2: Click on change password
Step 3: Change the password as mentioned in the below screen.

Posted in SQL Server | Leave a Comment »
Posted by Jugal Shah on May 22, 2012
Problem
Recently I moved PowerShell script files to a production environment and when executing it from the command prompt, I got this error: “File cannot be loaded because the execution of scripts is disabled on this system. Please see “get-help about_signing” for more details”. In this tip we cover what needs to be done to resolve this issue.
Solution
http://www.mssqltips.com/sqlservertip/2702/setting-the-powershell-execution-policy/
Posted in SQL Server, SQL Server 2008, SQL Server 2008 R2, SQL Server 2011 (Denali) | Tagged: Error, Script, T-SQL, Power Shell, get- help about_signing | 1 Comment »
Posted by Jugal Shah on May 21, 2012
In SQL Server a view represents a virtual table. Just like a real table, a view consists of rows with columns, and you can retrieve data from a view (even you can INSERT/UPDATE/DELETE data in a view). The fields in the view’s virtual table are the fields of one or more real tables in the database. You can use views to join two tables in your database and present the underlying data as if the data were coming from a single table, thus simplifying the schema of your database for users performing ad-hoc reporting. You can also use views as a security mechanism to restrict the data available to end users
See the below example how we can make the view read only.
--creating a sample table Create table tbl1 ( myID int, name varchar(10) ) --inserting data insert into tbl1 values(1,'Jugal'),(2,'SQL'),(3,'DBPool') --creating sample view create view vwtbl1 as select * from tbl1 --inserting data using view insert into vwtbl1 values(1,'Jugal'),(2,'SQL'),(3,'DBPool') --altering view to make it readOnly alter view vwtbl1 as select myid,name from tbl1 union all select 0,0 where 1 =0
INSERT/UPDATE/DELETE will fail with the below errors.
Msg 4406, Level 16, State 1, Line 1
Update or insert of view or function 'vwtbl1' failed because it contains a derived or constant field.
Msg 4426, Level 16, State 1, Line 1
View 'vwtbl1' is not updatable because the definition contains a UNION operator.
Posted in SQL Server, SQL Server 2008, Database, DB Articles, SQL Server 2008 R2, SQL Server 2011 (Denali) | Tagged: RDBMS, T-SQL, View, SQL Code, Query, Read Only | 1 Comment »
Posted by Jugal Shah on April 28, 2012
Problem
Recently I experienced a situation where a SQL Server login failed with this error message:
Error: 18456, Severity: 14, State: 10.
Login failed for user ‘SQL_Login’. Reason: Password validation failed with an infrastructure error. Check for previous errors. [CLIENT: XXX.XXX.XXX.XXX].
Can you help me decipher this SQL Server issue and correct it? Check out this tip to learn more.
Posted in SQL Scripts, SQL Server, SQL Server 2008, SQL Server 2008 R2, SQL Server 2011 (Denali) | Tagged: Error 18456, Login Failure, Severity 14, State 10, sys.dm_os_ring_buffers, sys.ms_ticks | 1 Comment »
Posted by Jugal Shah on April 16, 2012
Compound Primary key is a primary key which is created on more than one column. Now the questions is how to create the foreign key for the compound primary key where it references more than one column.
Check the below example.
create table employee
(
empID int not null,
SSN int not null,
name varchar(20)
)
ALTER TABLE [employee]
ADD CONSTRAINT pk_employee PRIMARY KEY (empID, SSN)
create table EmpDetail
(
empID int,
SSN int,
address varchar(20),
city varchar(20),
pin varchar(20)
)
ALTER TABLE dbo.empDetail
ADD CONSTRAINT FK_Employee
FOREIGN KEY(empID, SSN)
REFERENCES dbo.employee(empID, SSN)
SELECT
tc.TABLE_NAME,
tc.CONSTRAINT_NAME,
ccu.COLUMN_NAME
FROM
INFORMATION_SCHEMA.TABLE_CONSTRAINTS tc
INNER JOIN
INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE ccu
ON ccu.TABLE_NAME = tc.TABLE_NAME AND ccu.CONSTRAINT_NAME = tc.CONSTRAINT_NAME
WHERE
tc.TABLE_NAME IN ('employee','employeeDetail')
Posted in Database, SQL Server, SQL Server 2008, SQL Server 2008 R2, SQL Server 2011 (Denali) | Tagged: Compound Key, Foreign Key, SQL, SQL Constraint and Keys, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, T-SQL, Technology | Leave a Comment »
Posted by Jugal Shah on April 13, 2012
SQLDBPool Blog Stats
Posted in SQL Server | 2 Comments »
Posted by Jugal Shah on April 1, 2012
Dear Friends,
I want to share a good news with you all, I am again 3rd time awarded as MVP in SQL Server. Thanks for reading my site, I will keep posting the best article and always there to solve your queries.
Thanks,
Jugal Shah
You will see the 2012 in below award shortly -:)
Posted in SQL Server | 7 Comments »
Posted by Jugal Shah on March 29, 2012
Managing multiple SQL Servers has its challenges. One of the big challenges is having to collect data from each of the servers you manage and figure out which servers need attention. SQL Server has introduced a new feature called Central Management repository which can be used to manage multiple instances. One of the challenges to using CMS is that you have to register all the SQL Servers manually into CMS. The below article will guide you on how to register hundreds of servers in a second for SQL Server CMS.
Posted in SQL Server 2008, SQL Server 2008 R2 | Tagged: Script, Central Management Server, Jugal Shah, SQLDBPool, Power Shell, CMDB | 1 Comment »
Posted by Jugal Shah on March 28, 2012
Problem: Property IsLocked is not available for Login ‘[sa]‘. This property may not exist for this object, or may not be retrievable due to insufficient access rights. (Microsoft.SqlServer.Smo)
Solution: You will get the above error, in case of one of the below issue.
SQL Server authentication mode is Windows Only
You can check the SQL Server authentication mode using below query.
SELECT
CASE
SERVERPROPERTY(‘IsIntegratedSecurityOnly’)
WHEN 1 THEN
‘Windows Authentication’
WHEN 0 THEN
‘Windows and SQL Server Authentication’
END
as [Authentication Mode]
If the authentication mode Windows, you have to change the authentication mode is Mix Mode. You can change the authentication mode by right click on Server Properties -> Security tab.
This requires SQL Server Service restart.

SA Account is locked/Disable
You can execute below query to check whether SA account is locked or not. If the account is locked it will return 1 and 0 for un-locked.
SELECT
LOGINPROPERTY(‘sa’,
‘IsLocked’)
You can investigate whether SA account is locked by bad Password using below query. It will return the count of consecutive failed login attempts
SELECT
LOGINPROPERTY(‘sa’,
‘BadPasswordCount’);
GO
Right click on SA account and check the SA account properties, check the below properties of the SA login whether it is disabled or locked.

Execute the below script to unlock and enable the SA account
ALTER
LOGIN [sa] WITH
PASSWORD=N’Password’,
DEFAULT_DATABASE=[master],
DEFAULT_LANGUAGE=[us_english],
CHECK_EXPIRATION=OFF,
CHECK_POLICY=OFF
GO
ALTER
LOGIN [sa] ENABLE
GO
Posted in SQL Server | 1 Comment »
Posted by Jugal Shah on March 24, 2012
Step 1: Launch SQL Server Management Studio and In the Object Explorer expand the Management folder.
Step 2: Right click on the Maintenance Plans folder and select New Maintenance Plan.
Step 3: Give the meaning full name to maintenance plan.

Step 4: From the Toolbox drag and drop a Check Database Integrity Task, Rebuild Index Task, Update Statistics Task and place them vertically in the same order.
Step 5: Connect the tasks together by dragging the arrow from one box to the other so they are connected as: Check Database Integrity Task – Rebuild Index Task – Update Statistics Task.

Step 6 Right click on the each tasks and select the databases in maintenance plan.
Step 7 Schedule a maintenance plan to run in off business hours.
Posted in SQL Server | 1 Comment »
Posted by Jugal Shah on March 24, 2012
Step 1: Launch SQL Server Management Studio.
Step 2: In the object explorer, right click on the database and select Reports -> Standard Reports -> Index Physical Statistics.
Step 3: SQL Server Management Studio will generate a report showing information about the Table Names, Index Names, Index Type, Number of Partitions and Operation Recommendations.
Step 4: Repeat the above steps to check the fragmentation of all user databases.
One key value that is provided in the report is the Operation Recommended field. Any value of Rebuild is an indication that the index is fragmented.
By expanding the # Partitions field, you can see the % of fragmentation for a given index.
Report looks like below.

Posted in SQL Server | Leave a Comment »