Wednesday, 18 April 2018

How to unlock a locked account in sql server?

You tried to login a user and have this message / error:

The account is currently locked out. 




Solution:
Step 1: Login to sql server as Administrator

Step 2: Security >> Logins >> right click the user >> click Properties >> select Status page





Uncheck Login is locked out. and click Ok.

It will ask for "Reset password for the login while unlocking".

We need to go to General page and give password and Confirm password.

Click Ok.

Monday, 16 April 2018

GIT Repository update via Visual Studio 2015

Using the Visual Studio Enterprise 2015 for repository update regarding database projects, usually need to compare the database schema and then commit the changes to remote.

The steps are

1. Connect the project from Team Explorer
2. Git Flow >> Create Feature and give the feature a name / tag.
3. Solution Explorer >> right click the solution and select Schema Compare
in Schema Compare screen [Compare] we have Source and Targets Schema. select the objects and click [Update].
4. in Team Explorer GitFlow select Finish Feature.

Wednesday, 11 April 2018

How to check if a table is exist or not?

The following are queries to check the object / table exist or not before create / drop in Sql Server.

 IF OBJECT_ID('dbo.temp_data') IS NOT NULL
       BEGIN
            execute (N'DROP TABLE [dbo].[temp_data]')
        END

    IF OBJECT_ID('dbo.temp_data') IS NULL
BEGIN
       CREATE TABLE [dbo].[temp_data](
                [no] [int] NULL,
                [empname] [varchar)100)] NULL,
                [empDept] [varchar(100)] NULL,
                [empLocation] [varchar(100)] NULL
            ) ON [PRIMARY]
        END

How to unlock a locked account in sql server?

You tried to login a user and have this message / error: The account is currently locked out.  Solution: Step 1: Login to sql ser...

Popular