Tuesday, October 9, 2012

How to insert data from view to table in sql server

Recently i have work with large database for data insertion which is from "excel sheet".For this first I will export data from  excel sheet to data table,then  "create view" (test_orders)which has data based on where condition.
insert into orders(ordr_code,ordr_desc,ordr_code,price_amt)
select [Title ID] ,Name,replace(ORDERCODE,'-',''),[List Price] from [test_orders]
In the above first i have select the data from view then insert into desired table.Here i have done string replacement for one column when fetch the data from view

No comments:

Bel