Thursday, 20 June 2013

Insert bulk data from view to sql table

In this article we will see how to insert bulk data from view to sql table.

example::

1)Create table::

Table1:


Create table emp (id int ,emp_name varchar(100))
Insert into emp (id,emp_name)values(1,'raj')
Insert into emp (id,emp_name)values(2,'sham')
Insert into emp (id,emp_name)values(3,'ram')
Insert into emp (id,emp_name)values(4,'ss')
Insert into emp (id,emp_name)values(5,'d.raj')
Insert into emp (id,emp_name)values(6,'pranav')
Insert into emp (id,emp_name)values(7,'pranav')
Insert into emp (id,emp_name)values(8,'aditya')
Insert into emp (id,emp_name)values(9,'aditya')

Table2:

Create table #temp (id int ,emp_name varchar(100))

2)Create View::


create view sql_view
as
select id,emp_name from emp

3)insert from sql View to table::



insert into #temp (id,emp_name)select * from sql_view
select * from #temp

Related Posts

Column in comma separated strings
Pivot Unpivot data in sql server
Combine two or more column in one column in sql sever
rank fuctions in sql
Get month wise Number of working
Take Back up of table using select statement in sql server
Column data in comma seprated string
Delete duplicate records from table
Date function in sql server
Sql server::String with initial letter in uppercase.
Joins in Sql server
Dynamic Query in sql server
Basic About View
send sql table data via email using store procedure
How to use Store Procedure inside a store procedure
SET ANSI_NULLS in sql server
SET QUOTED_IDENTIFIER in sql
example of Cursor in sql server
basic of Cursor in sql.
delete duplicate records in sql server
select duplicate records in sql server
update duplicate records in sql server
comman table expression(CTE) in sql server
Split Funtions in sql server
Sql queries for sql server
Trigger on Update
Trigger on insert
trigger on delete
basic of trigger
insert into view with multiple tables
Insert into View in sql server
Interview queries in sql server
update data in view with multiple table
Update view with single table
Group by in sql server
pivot without aggregate function in sql
loop in sql server
get monthwise calender in sql server
temp table and temp variable in sql server

No comments:

Post a Comment

8451831077