ALTER PROCEDURE [dbo].[Create_New_User] ( @NewUserName VARCHAR(32), @NewPassword NVARCHAR(8) ) AS SET NOCOUNT ON CREATE LOGIN [@NewUserName] WITH PASSWORD ='123', DEFAULT_DATABASE=[Kansar], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
declare @userid varchar(50)='santhosh' declare @password varchar(50)='kumartest123' exec sp_addlogin @loginame = @userid, @passwd = @password, @defdb = 'Santhosh', @deflanguage = [British], @sid = null, @encryptopt= null
Alter procedure sp_CreateLogin @name varchar(256), @password varchar(128) as declare @sqlcmd varchar(2000); begin tran; set @sqlcmd = 'create login ' + quotename(@name) + ' with password = ' + quotename(@password, ''',check_policy=OFF'); exec (@sqlcmd); if @@error <> 0 begin rollback tran; print 'Cannot create login' return; end commit tran; go exec sp_CreateLogin 'santhosh','kumar1222'
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)