执行 SQL 脚本问题
一下脚本 在查询分析器中执行 没有错误 为什么 在 delphi 里面 用 Query 执行有错误里 ***** 该脚本 是我 在查询分析器中测试过的 然后 保存在表中 Query 执行时 也是从表中 查询出来的 经核对 没有错误的 请高手指点一下.
if exists (select * from dbo.sysobjects where id = object_id(N '[dbo].[test_niubin] ') and OBJECTPROPERTY(id, N 'IsProcedure ') = 1)
drop procedure [dbo].[test_niubin]
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE procedure test_niubin
as
if exists(Select * from tempdb..sysobjects where name like '#SumDepProfitTable% ')
drop table #SumDepProfitTable
select * into #SumDepProfitTable from r_DepProfit_Acct_niu
alter table #SumDepProfitTable add F111 money
alter table #SumDepProfitTable add F222 money
select * from #SumDepProfitTable
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
[解决办法]
Delphi里边在同一个Query是不允许这种用法的.
必须分两次执行
[解决办法]
先执行Drop,再Create