Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem Forcing Password Change
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Problem Forcing Password Change
Miscellaneous
Thread ID:
01396746
Message ID:
01396746
Views:
103
I'm sure I've got something wrong here, but I just don't know what it is:
USE [master]
GO

DECLARE @LoginName VARCHAR(20)
DECLARE @Password VARCHAR(20)
DECLARE @SqlStatement NVARCHAR(MAX);

SET @LoginName = 'TestABC'
SET @Password = 'testabc'


--ALTER LOGIN TestABC WITH CHECK_EXPIRATION = ON
--ALTER LOGIN TestABC WITH PASSWORD = 'testabc' UNLOCK MUST_CHANGE

SET @SqlStatement = N'ALTER LOGIN [' + @LoginName + '] WITH CHECK_EXPIRATION = ON'
EXECUTE (@SqlStatement);

SET @SqlStatement = N'ALTER LOGIN [' + @LoginName + '] WITH PASSWORD = [' + @Password + '] UNLOCK MUST_CHANGE'
EXECUTE (@SqlStatement);
It errors with "Syntax error near Password"

Thanks
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Next
Reply
Map
View

Click here to load this message in the networking platform