我们有Powerbuilder应用程序在迁移到2005之前在2000 db上正常运行。现在我们收到以下错误:
sqlstate 5001错误“已经有一个名为PKCURSOR的对象 数据库“
下面的部分代码已经通过添加掉落约束PKCURSOR进行了修改。因此,对于安装了powerbuilder并且从网络驱动器运行应用程序的两个dba,现在不会弹出错误。另一个用户从她的网络驱动器运行它并获取错误。我也让那个用户成了dbo但仍然得到了错误。 有什么想法吗?
ALTER PROCEDURE [dbo].[GUMBO_SP_PROP_ACTUAL_ACCOMPLISHMENTS_PF]
@PROG_YEAR CHAR(4)
AS
DECLARE @PROGRAM_YEAR CHAR(4),
@SUM_LOW_MOD_PERSONS_PROPOSED INTEGER,
@SUM_LOW_MOD_PERSONS_ACTUAL INTEGER,
@SUM_TOTAL_PERSONS_PROPOSED INTEGER,
@SUM_TOTAL_PERSONS_ACTUAL INTEGER,
@ERROR_STRING CHAR(132),
@ACTIVITY_CODE CHAR(3)
CREATE TABLE #ACCOMPLISHMENTS(
PROGRAM_YEAR CHAR(4) NOT NULL,
ACTIVITY_CODE CHAR(3) NOT NULL,
TOTAL_PERSONS_PROPOSED DECIMAL(18,2) DEFAULT 0,
TOTAL_PERSONS_ACTUAL DECIMAL(18,2) DEFAULT 0,
LOW_MOD_PERSONS_PROPOSED DECIMAL(18,2) DEFAULT 0,
LOW_MOD_PERSONS_ACTUAL DECIMAL(18,2) DEFAULT 0
)
-- Alter the temporary table to have a primary key of application number and program year.
ALTER TABLE #ACCOMPLISHMENTS
ADD CONSTRAINT PKCURSOR PRIMARY KEY (PROGRAM_YEAR, ACTIVITY_CODE)
DECLARE ACTIVITY_CURSOR CURSOR FOR
SELECT dbo.ACTIVITY_CODE.activity_code
FROM dbo.ACTIVITY_CODE
WHERE
(dbo.ACTIVITY_CODE.activity_code LIKE 'P%%')
and (dbo.ACTIVITY_CODE.activity_code <> 'P01')
ORDER BY dbo.ACTIVITY_CODE.activity_code
ALTER TABLE #ACCOMPLISHMENTS
DROP CONSTRAINT PKCURSOR