如何将交叉表查询的结果写入ACCESS数据库?
前两天写了一个存储过程时将交叉表查询结果写入一sql server表中,但因为此为一临时表,故想将它写入本地的一access数据库中,可否用一存储过程实现呢?若不能,最简单的实现方法是什么?
已写好的存储过程如下:
CREATE PROCEDURE dbo.Gen_T_EmployeePayrollDetail
AS
declare @sql varchar(8000)
set @sql='select employee_code'
select @sql=@sql+',sum(case when payroll_item_uuid='''+payroll_item_uuid+''' then amount end) ['+payroll_item_uuid+']'
from (select distinct payroll_item_uuid from employee_payroll_item_detail) a
set @sql=@sql+' into T_EmployeePayrollDetail from employee_payroll_item_detail group by employee_code'
exec (@sql)
GO