Creating SQL Login for the users registered in Local Users / Groups (Windows ):
USE [master]
GO
CREATE LOGIN [SQL\snreddy] FROM WINDOWS
WITH DEFAULT_DATABASE=[master],
DEFAULT_LANGUAGE=[us_english]
Create SQL login :
USE [master]
GO
CREATE LOGIN [snreddy] WITH PASSWORD=N'lDÇ°üÉUÛ^¼h nðÿ$©9 kez£ Ã`øM', DEFAULT_DATABASE=[master],
DEFAULT_LANGUAGE=[us_english],
CHECK_EXPIRATION=OFF,
CHECK_POLICY=ON
Creating user and mapping to Login :
Create user <User Name > for Login <Login_Name> -- For SQL Login
Create user <User Name > from login <Login_Name> -- For Windows Login
USE [master]
GO
CREATE LOGIN [SQL\snreddy] FROM WINDOWS
WITH DEFAULT_DATABASE=[master],
DEFAULT_LANGUAGE=[us_english]
Create SQL login :
USE [master]
GO
CREATE LOGIN [snreddy] WITH PASSWORD=N'lDÇ°üÉUÛ^¼h nðÿ$©9 kez£ Ã`øM', DEFAULT_DATABASE=[master],
DEFAULT_LANGUAGE=[us_english],
CHECK_EXPIRATION=OFF,
CHECK_POLICY=ON
Creating user and mapping to Login :
Create user <User Name > for Login <Login_Name> -- For SQL Login
Create user <User Name > from login <Login_Name> -- For Windows Login
Note :
Login will be created at server level where as user will be created at database level i.e
Login grants a principal entry into the server where as user grants a login entry into a database.
One Login can be associated with many users (one per database ).
Hi Bro,
ReplyDeleteHow to find all enabled jobs & disabled jobs list
in the server
Great job Sai
ReplyDeleteHi Sai, Could you please post the VB script for excel refresh(worksheet) can use in SSIS.
ReplyDeleteThanks in advance.
--Get Information for all SQL Server Agent Jobs
ReplyDeleteuse msdb
go
Select * from dbo.sysjobs
--Wrong Way to disable SQL Server Agent Jobs.
--If Schedule will be enabled, Job will keep Running.
update dbo.sysjobs
set enabled=1
--Update the schedule as well if you want to disable by updating sysjobs table
Select * from dbo.syschedulers
--Right Way to Disable/Enable Jobs. Generate Scripts for Enable/Disable
Select 'EXEC msdb.dbo.sp_update_job @job_name='''+ name +N''', @enabled = 0;'
from dbo.sysjobs