August 25, 2008 at 2:47 pm
Trying to create a stored procedure to call from web page
To reset passwords but keeps erroring with line at the word PASSWORD
DECLARE @SQLString NVARCHAR(500),
@Password NVARCHAR(20),
@USERNAME nvarchar(100)
SELECT @Username = 'TEST'
SELECT @Password = 'TEST'
SET @SQLString = 'ALTER LOGIN ' + @username + ' WITH PASSWORD = [' + @Password + ']'
exec sp_executesql @SQLString
Any suggestions
August 25, 2008 at 3:27 pm
TRACEY (8/25/2008)
... + '' WITH PASSWORD = [' + @Password + ']'
Brackets ("[ ]") are not a universal substitute for apostrophes (" '...' ") when quoting text. Get rid of the brackets and use this syntax instead:
... ' WITH PASSWORD = ''' + @Password + ''''
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
August 25, 2008 at 3:43 pm
Cheers....
August 29, 2008 at 1:46 pm
I created this stored procedure for a LOGIN weblogin login to run.
I have a role and added this stored procedure and weblogin user in it and granted the exec to this stored procedure.
Is the weblogin need to have securityadmin rights.
Is there a way just to grant for this one procedure only rather than giving out securityadmin.
The procedures is just to alter login
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply