Home » Posts tagged 'TSQL'

Tag Archives: TSQL

Always on\Database Mirroring Automatic Page Repair

A special thanks to Daniel Jones [daniel.jones.0543@gmail.com] for showing up interest and writing informative article for our blog (http://mssqlfun.com/).   Always on\Database Mirroring Automatic Page Repair One of the most useful as well as hottest feature in SQL Server is mirroring of database. It is helpful for numerous of organizations that implements the successful as … Continue reading

How Row versioning impact tempDB ?

Scenario: DBA found that tempdDBdatabase usage is getting high and most of the size is consumed by row versioning. DBA raised the issue with application team running that query. Once Application team close the session, tempDB usage comes normal. Question: Application tea raise concern “How can a select statement on table consume huge amount of … Continue reading

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

Write-Host || Cannot invoke this function because the current host does not implement it

Issue: While running powershell in SQL job step, I am getting below error: – A job step received an error at line 13 in a PowerShell script. The corresponding line is ‘Write-Host “ServerName: ” $comp’. Correct the script and reschedule the job. The error information returned by PowerShell is: ‘Cannot invoke this function because the … 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

%d bloggers like this: