Monday, November 26, 2012

How to INSERT into a table records extracted from another table?

If you want to insert values from one table into another you can use this sql query.

insert into TBL_TARGET([USERNAME],[PASSWORD],[ACTION])
select [USERNAME] ,[PASSWORD], 'I'
from [TBL_SOURCE]


Don't use any extra 'VALUES' or parenthesis.

How to solve error 15128 in Microsoft Sql Server ?

If you ever meet this nice Sql Error, 15128 in Microsoft Sql Error you must do these next steps. At least they worked for me :)
First I want to explain which is the scenario. You are logged with Windows Authentication and you created a new sql login. Now you want to disable Enforce Password Policy. When you want to do that Sql tells you that you can not save the user, a new password must be set. Strange...so:

  • double click on new login created, leave the check boxes checked(enforce password policy and enforce password expiration) and change user's password temporally to what ever you want, click OK
  • then reopen and uncheck enforce password policy, enforce password expiration; Press OK
  • finally you reopen the user and specify the password you want
  • Test it ;)
Hope this will help you.