Search This Blog and Web

Tuesday, October 21, 2014

SQLCMD.exe in SQL Server 2012 does not give real-time output logging

I hit into an another issue in SQL 2012 related to real-time logging.
I've logged bug here : https://connect.microsoft.com/SQLServer/feedback/details/1002565

The problem is when a long running Stored Procedure is run using sqlcmd.exe of SQL Server 2012, the output is not displayed in real-time. It gets displayed only after the query completes or user stops it.

In SQL Server 2008's sqlcmd.exe, the output is displayed as-is without any delay.

Workaround : The behaviour is not there in OSQL.exe.

Since Microsoft wants us to use sqlcmd.exe in place of osql.exe, I think this thing should be fixed.
Please vote-up.

[Script] Get Disk Space using PowerShell

I posted a simple script at Technet which returns the free space of a specific drive on any computer.

Take a look here : https://gallery.technet.microsoft.com/scriptcenter/Get-Disk-Space-using-69c88b59

Basic Code :

Write-Host "Getting Information for Drive : $DriveID for Computer : $CompName" 
 
# Get Info about the disk specified 
$Disk = Get-WMIObject Win32_LogicalDisk -ComputerName $CompName -Filter "DeviceID='$DriveID'"  
 
 
$FreeSpace = [System.Math]::Round((($Disk.FreeSpace) / 1GB)) 
Write-Host "Drive $DriveID has freespace : $FreeSpace GB"

The script can be improved using PS-Remoting for better performance.

Featured Post

Timeout problem in Backup-SQLDatabase cmdlet in SQLPS module

Power Shell is for managing all types of technologies be it SQL, EXchange, Lync, Office etc.( just name it ) These technologies usually cr...