Tag Archives: SQL Tables

T-SQL script to find the highly populated tables in database

By | January 9, 2015

Sometimes we need to check which tables of our database is highly populated. Below is the T-SQL Script which we can use to find out that. SELECT      t.NAME AS TableName,     i.name as indexName,     sum(p.rows) as RowCounts,     sum(a.total_pages) as TotalPages,      sum(a.used_pages) as UsedPages,      sum(a.data_pages)… Read More »

How to rename a Table in Sql Server

By | January 2, 2012

To rename a column in a SQL Table following command can be reused: SP_RENAME  ‘old table name’, ‘New table name’ For example, if we want to rename the table from employee to employeemaster, following command can be used. SP_RENAME  ’employee’, ’employeemaster’ This command will rename the table from employee to employeemaster.

Renaming a column in Sql Server

By | September 6, 2010

 We often need to change the name of a column of a table to a new name. We  can do this with the help of the Exec Sp_rename command.  The Syntax of the Sp_rename is given below:-  Exec sp_rename ‘TableName.[OldColumnName]’, ‘[NewColumnName]’, ‘Column’  For example, suppose we have a table called Employee who has the following structure:-… Read More »

Different ways to create a table and insert data into the table

By | October 12, 2009

Tables can be defined as the structure which contains the data in the database. There can be many ways to create table and to insert data into the table. Some of the ways to create a table is given below:- 1)Creation of a table with the help of a create statement For example, suppose we… Read More »