Web Analytics Made Easy - Statcounter

SQL Script to find the tables created from a given date

Below is the SQL query which can be used to find out the tables which are created or modified on or from a given date. SELECT         [name] as Tablename        ,create_date        ,modify_date FROM         sys.tables where cast(create_date as date)>=’Given date’ 

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

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

Adding , Deleting and Updating a Column in a table

blank

Many times we need to alter the table definition by adding , deleting or updating a column in the table. In this article, I am trying to explain the following :- 1. How to add a column 2. How to update a column 3. How to drop a column Suppose we have a table say … Read more

How to rename a Table in Sql Server

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

blank

 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

Introduction Tables can be defined as the structure which contains the data in the database. This article discuss about the different ways to create a table and 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 … Read more