26 Aralık 2011 Pazartesi

the Size Of All Tables

SET NOCOUNT ON

DBCC UPDATEUSAGE(0)

-- DB size.

EXEC sp_spaceused

-- Table row counts and sizes.

CREATE TABLE #t
(
    [name] NVARCHAR(128),
    [
rows] CHAR
(11),
    reserved
VARCHAR
(18),
   
data VARCHAR
(18),
    index_size
VARCHAR
(18),
    unused
VARCHAR
(18)
)

INSERT #t
EXEC sp_msForEachTable 'EXEC sp_spaceused ''?'''

SELECT *
FROM   #t

-- # of rows.

SELECT SUM(CAST([rows] AS int)) AS [rows]
FROM
   #t
 

DROP TABLE #t

 

2 Aralık 2011 Cuma

compare identitcal files of folder

:bof

    @echo off
    setlocal

:init
  
    set dirDEST=d:\TEST\NEW\
    set dirSOURCE=d:\TEST\OLD\

    if not exist "%dirDEST%" echo dirDEST not found & goto :EOF
    if not exist "%dirSOURCE%" echo dirSOURCE not found & goto :EOF

    for /f "delims=" %%a in ('dir /b /a-d "%dirDEST%" 2^>NUL') do if not exist "%dirSOURCE%%%a" echo %%a does not exist in "dirSOURCE"  
    for /f "delims=" %%a in ('dir /b /a-d "%dirSOURCE%" 2^>NUL') do if not exist "%dirDEST%%%a" echo %%a does not exist in "dirDEST"

 
:eof