My Blog List

hotinit.com. Powered by Blogger.

Search This Blog

SQL SERVER - Insert from one table to another Table

Thursday, 10 May 2012

In SQL Database, You can probably insert data from one table into another using two methods.
1. Insert Into - This is used when the table to which the data is going to be inserted is already present.
2. Select Into -  This is used when the table to which the data is going to be inserted is not present and is to be created on the go when inserting the data.  

Syntax for Insert Into

INSERT INTO NewEmployeeTable (EmpId)
SELECT EmpId
FROM OldEmployeeTable 
In the above syntax the table NewEmployeeTable is already there and we are inserting EmpId from the OldEmployeeTable into the exisiting NewEmployeeTable.

Syntax for Select Into

SELECT * INTO  NewTableName FROM ExistingTableName
In the above syntax it creates the new table and inserts the data from the existing old table.Thus the insert form one table to another table is done in Sql Server using Tsql. 
Check this post to read how to Insert into Table from Stored Procedure.




SQL SERVER – Insert Into from Stored procedure

In SQL DatabaseTo insert into table from stored procedure you need to create a table with fields and data types which comes as a result of executing Stored Procedure.

1. Create Table

CREATE TABLE Employee (EmpId INT)

2. Run Execute Stored Procedure with Insert into above it

INSERT INTO Employee (EmpId)
EXEC Proc_InsertEmployeeId
GO

You have successfully learnt how to insert into table from the store procedure.


Check this post to read how to Insert from one table to another Table.

About Database

Friday, 4 May 2012

What is a Database?

Database is an organized way of storing information, making it easy to get the information at later time.
Eg, storing organized data in Excel file(.xlsx file extension) is called Excel database. storing data in microsoft sqlserver file(.mdf file extension ) is called Sql database.

What is database software ?

Database Software is a tool to store organized data. Examples of database software will be
Excel, Sql Server, Mysql, Sqllite, postgresql,Apache Cassandra , google big table etc.,

Types of Database

Hierarchical Databases -- data is organized like a Pyramid. Oldest method of storing data.Used in IBM mainframe Computers
Network Databases - same like hierarchical database but this has an hierarchical structure. 
Relational Databases - This is used in sql server where the data are linked by relationships (using keys)
Object Oriented Databases - This kind of database can be used to store variety of media sources such as images,text,videos etc.,

Free Database Softwares

MySQL-- MySQL is a widely used opensource Database.
SQLite-- SQLite is a  opensource Databas which is widely used in Mobiles phones and ipads .
PostgreSQL--  This is another Famous open source database.

All the above three databases are cross-platform which means it support multiple operating systems like linux,Windows,Mac OS X, Solaris , FreeBSD etc.,

 

Blogger news

Blogroll

Most Reading

8.6/10