Articles → SQL SERVER → Views for data abstraction

Views for data abstraction























customer_idcustomer_namecustomer_address




order_idcustomer_idorder_details




payment_idorder_idpayment_details






create procedure sp_get_customer_information As begin 
select 
  customer_id, 
  customer_name, 
  customer_address 
from 
  tbl_customer_information end




create procedure sp_get_monthly_reports As begin 
select 
  ci.customer_id, 
  ci.customer_name, 
  ci.customer_address, 
  co.order_details 
from 
  tbl_customer_information ci 
  inner join tbl_customer_orders co on ci.customer_id = co.customer_id end
















create view v_customer_information as 
select 
  customer_first_name, 
  customer_last_name, 
  customer_city, 
  customer_state 
from 
  tbl_customer_information




create procedure sp_get_monthly_reports As begin 
select 
  ci.*, 
  co.order_details 
from 
  v_customer_information ci 
  inner join tbl_customer_orders co on ci.customer_id = co.customer_id end





Posted By  -  Karan Gupta
 
Posted On  -  Wednesday, March 30, 2011

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250