Execute SqlServer script using command prompt

0 comments
Execute SQL Server script using command prompt.


sqlcmd -S myServer\instanceName -U sa -P sa1234 -d Northwind -i C:\myScript.sql


Sql server query to find all tables and space they used

0 comments

This query is used to find all tables and space they used


SELECT sum ( used_page_count ) * 8 as SizeKB,
  sum(row_count) as [RowCount], object_name ( object_id ) AS TableName
FROM sys.dm_db_partition_stats
WHERE index_id=0 or index_id=1
GROUP BY object_id
ORDER BY sum ( used_page_count ) DESC

Vikram Chandra Theme by BloggerThemes & NewWPThemes Sponsored by iBlogtoBlog