Home » Database (Page 2)

Category Archives: Database

Restrict user to login from single Host

Restricting user to login from single host may be sometimes required from security point and other business requirements. We can achieve it through SERVER LEVEL LOGON TRIGGER. ALTER TRIGGER TR_CHECK_LOGIN_TEST_HOST ON ALL SERVER FOR LOGON AS BEGIN DECLARE @HOSTNAME VARCHAR(48) DECLARE @PROGNAME VARCHAR(100) SELECT @HOSTNAME = HOST_NAME FROM SYS.DM_EXEC_SESSIONS WHERE SESSION_ID = @@SPID IF ORIGINAL_LOGIN() … Continue reading

Error While running PowerShell code from SQL Agent job – “Path Does Not Exist”

Issue: When I am running code from PowerShell console its running fine but when I execute it through SQL agent job step, I am getting below error: – The job script encountered the following errors. These errors did not stop the script:  A job step received an error at line 14 in a PowerShell script. … Continue reading

What’s new in SQL Server 2016 installation?

1) As MS is kept increasing number of option while installation. To reduce no. of click, if setup pass Rules it will automatically moves to Next window. 2) On Server Configuration page, MS specifically ask to GRANT PERFORM VOLUME MAINTENANCE TASK permission to service account. SQL Services needs this access to perform instant file initialization … Continue reading

Sequence – Long awaited feature

As per BOL (https://msdn.microsoft.com/en-us/library/ff878058(v=sql.110).aspx) : A sequence is a user-defined schema-bound object that generates a sequence of numeric values according to the specification with which the sequence was created. The sequence of numeric values is generated in an ascending or descending order at a defined interval and may cycle (repeat) as requested. Sequences, unlike identity … Continue reading

Creation & Deletion of Database Snapshot by SQL Agent Job

Some days back, I received one query on my facebook page that user want to create Database Snapshot frequently & want to delete the oldest with same frequency. Quite interesting scenario. I did not go in deep why he has such requirement but I am clear that It can be done very easily. So let’s … Continue reading

%d bloggers like this: