I have a deployment script that installs a database, a login and a user for the database (using the login). Everything works but for some reason, the password does not match the one specified in the script. The script looks like:
USE [master]
GO
CREATE DATABASE TestDB;
GO
ALTER DATABASE [TestDB] SET COMPATIBILITY_LEVEL = 100
GO
ALTER DATABASE [TestDB] SET ANSI_NULL_DEFAULT OFF
GO
::
IF NOT EXISTS (SELECT * FROM sys.server_principals WHERE name = N'TestDBUser')
CREATE LOGIN [TestDBUser] WITH PASSWORD='TestPassword', DEFAULT_DATABASE=[TestDB], DEFAULT_LANGUAGE=[us_english], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
GO
USE [TestDB]
GO
CREATE USER [TestDBUser] FOR LOGIN [TestDBUser] WITH DEFAULT_SCHEMA=[dbo]
GO
EXEC sp_addrolemember db_datareader, [TestDBUser]
GO
EXEC sp_addrolemember db_datawriter, [TestDBUser]
GO
::
In SQL Server Management Studio I can open the properties of the Login and change its password (it appears it has one character less) and then everything works as expected. Why does SQL not take the literal password and how can I make it work?