/*============================================================================
  File:     SQLCMDINI.sql

  Summary:  This script can be used as an input script, executed within SSMS,
			or used as a SQLCMDINI.sql script. Use the SQLCMDINI environment
			variable to use this for sqlcmd initialization.

  Date:     May 2005

  SQL Server Version: 9.00.1116 (IDW14)
------------------------------------------------------------------------------
  Copyright (C) 2005 Kimberly L. Tripp, SYSolutions, Inc.
  All rights reserved.

  For more scripts and sample code, check out 
    http://www.SQLskills.com

  This script is intended only as a supplement to demos and lectures
  given by Kimberly L. Tripp.  
  
  THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF 
  ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED 
  TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  PARTICULAR PURPOSE.
============================================================================*/

:SETVAR SQLCMDMAXVARTYPEWIDTH 25
:SETVAR SQLCMDMAXFIXEDTYPEWIDTH 25

SET NOCOUNT ON

PRINT 'Initialization script for SQLCMD'
PRINT 'Script execution start time: ' + convert(char(26), getdate(), 109)
PRINT ' '

SELECT CONVERT(nvarchar(20), SERVERPROPERTY('MachineName'))
		+ N'\' + CONVERT(nvarchar(20), ISNULL(SERVERPROPERTY('InstanceName'), 'Default (local)')) 
			AS 'Machine\InstanceName'
	, SERVERPROPERTY('Edition') AS 'Edition'
	, SERVERPROPERTY('ProductVersion') AS 'Version'
PRINT ' '
SELECT TOP 10 loginame, physical_io, last_batch
FROM master.dbo.sysprocesses
WHERE spid > 50 AND physical_io > 0
ORDER BY physical_io DESC
PRINT ' '
go

-- RESET Environment variables
:SETVAR SQLCMDMAXVARTYPEWIDTH 1024
:SETVAR SQLCMDMAXFIXEDTYPEWIDTH 1024
go

SET NOCOUNT OFF
go