郭老师:Adaptive Server Anywhere 存储过程 语法和SQL2000 有什么区别?
郭老师:Adaptive Server Anywhere 存储过程 语法和SQL2000 有什么区别?
创建一个简单的语句都错?
CREATE PROCEDURE ruku
AS
SELECT * FROM ydjq
go
exec ruku
[解决办法]
怎么还冒出个 郭老师。。。。
贴一个曾经写过的 asa的存储过程
ALTER PROCEDURE "spectwosuite"."zu_proc_g_34"(in p_evaluationdate datetime,in p_vessel numeric(15),in p_name numeric(15))
begin
create table #tmptable(
employeeid numeric(15) null,
name varchar(200) null,
Rank varchar(200) null,
Birth datetime null,
Vessel numeric(15) null,
company varchar(50) null,
evaluationdate datetime null,
Port_joined varchar(50) null,
Date_joined datetime null,
Port_signed_off varchar(50) null,
Date_signed_off datetime null,
Jan_Jun varchar(50) null,
Jul_Dec varchar(50) null,
New_joiner varchar(50) null,
Sign_off varchar(50) null,
uOthers varchar(50) null,
Category01 varchar(50) null,
Category02 varchar(50) null,
Category03 varchar(50) null,
Category04 varchar(50) null,
Category05 varchar(50) null,
Category06 varchar(50) null,
Category07 varchar(50) null,
Category08 varchar(50) null,
Category09 varchar(50) null,
Category10 varchar(50) null,
Category11 varchar(50) null,
Category12 varchar(50) null,
Category13 varchar(50) null,
Category14 varchar(50) null,
Remarks varchar(500) null,
CPD varchar(500) null,
ISM varchar(500) null,
ESD varchar(500) null,
BD varchar(500) null,
employalbe varchar(50) null,
);
insert into #tmptable( employeeid,name,rank,Birth,evaluationdate )
select distinct "employee"."employeeid","employee"."surname", "empranktype"."description" , "employee"."birthdate" , "empevaluation"."evaluationdate"
FROM "empevaluation" LEFT OUTER JOIN "employee" ON "employee"."employeeid" = "empevaluation"."employeeid" LEFT OUTER JOIN "empranktype" ON "empranktype"."empranktypeid" = "employee"."employeerankid"
where empevaluation.EMPEVALPROFILEID=12500000002;
update #tmptable
set company =(
SELECT top 1 "address"."name"
from "address" ,"empcontract" where "empcontract"."companyaddressid" = "address"."addressid"
and "empcontract"."employeeid" = #tmptable .employeeid ) ;
update #tmptable
set Vessel =(
SELECT "empevaluation"."ZU_VESSEL"
from "empevaluation" where "empevaluation"."evaluationdate" = "#tmptable"."evaluationdate"
and "#tmptable"."employeeid" = "empevaluation"."employeeid"
and "empevaluation"."ZU_VESSEL" is not null) ;
update #tmptable
set Port_joined =(
SELECT "empevaluation"."ZU_PORTJOINED"
from "empevaluation" where "empevaluation"."evaluationdate" = "#tmptable"."evaluationdate"
and "#tmptable"."employeeid" = "empevaluation"."employeeid"
and "empevaluation"."ZU_PORTJOINED" is not null) ;
update #tmptable
set Date_joined =(
SELECT "empevaluation"."ZU_DATEJOINED"
from "empevaluation" where "empevaluation"."evaluationdate" = "#tmptable"."evaluationdate"
and "#tmptable"."employeeid" = "empevaluation"."employeeid"
and "empevaluation"."ZU_DATEJOINED" is not null) ;
update #tmptable
set Port_signed_off =(
SELECT "empevaluation"."ZU_PORTSIGNEDOFF"
from "empevaluation" where "empevaluation"."evaluationdate" = "#tmptable"."evaluationdate"
and "#tmptable"."employeeid" = "empevaluation"."employeeid"
and "empevaluation"."ZU_PORTSIGNEDOFF" is not null) ;
update #tmptable
set Date_signed_off =(
SELECT "empevaluation"."ZU_DATESIGNEDOFF"
from "empevaluation" where "empevaluation"."evaluationdate" = "#tmptable"."evaluationdate"
and "empevaluation"."ZU_DATESIGNEDOFF" is not null) ;
update #tmptable
set employalbe =(
SELECT "empevaluation"."ZU_EMPLOYABLE"
from "empevaluation" where "empevaluation"."evaluationdate" = "#tmptable"."evaluationdate"
and "#tmptable"."employeeid" = "empevaluation"."employeeid"
and "empevaluation"."ZU_EMPLOYABLE" is not null) ;
update #tmptable
set Jan_Jun =(
SELECT EMPEVALRESULT.code
from EMPEVALRESULT,"empevaluation",EMPEVALSCORE
where EMPEVALRESULT.EMPEVALRESULTID=EMPEVALSCORE.EMPEVALRESULTID
and "#tmptable"."employeeid" = "empevaluation"."employeeid"
and "empevaluation"."evaluationdate" = "#tmptable"."evaluationdate"
and EMPEVALSCORE."empevaluationid" = empevaluation.empevaluationid
and empevaluation.EMPEVALPROFILEID=12500000008
and EMPEVALSCORE.EMPEVALCRITERIAID=12500000025);
update #tmptable
set Jul_Dec =(
SELECT EMPEVALRESULT.code
from EMPEVALRESULT,"empevaluation",EMPEVALSCORE
where EMPEVALRESULT.EMPEVALRESULTID=EMPEVALSCORE.EMPEVALRESULTID
and "empevaluation"."evaluationdate" = "#tmptable"."evaluationdate"
and EMPEVALSCORE."empevaluationid" = empevaluation.empevaluationid
and empevaluation.EMPEVALPROFILEID=12500000008
and EMPEVALSCORE.EMPEVALCRITERIAID=12500000026);
update #tmptable
set New_joiner =(
SELECT EMPEVALRESULT.code
from EMPEVALRESULT,"empevaluation",EMPEVALSCORE
where EMPEVALRESULT.EMPEVALRESULTID=EMPEVALSCORE.EMPEVALRESULTID
and "#tmptable"."employeeid" = "empevaluation"."employeeid"
and "empevaluation"."evaluationdate" = "#tmptable"."evaluationdate"
and EMPEVALSCORE."empevaluationid" = empevaluation.empevaluationid
and empevaluation.EMPEVALPROFILEID=12500000008
and EMPEVALSCORE.EMPEVALCRITERIAID=12500000027);
update #tmptable
set Sign_off =(
SELECT EMPEVALRESULT.code
from EMPEVALRESULT,"empevaluation",EMPEVALSCORE
where EMPEVALRESULT.EMPEVALRESULTID=EMPEVALSCORE.EMPEVALRESULTID
and "#tmptable"."employeeid" = "empevaluation"."employeeid"
and "empevaluation"."evaluationdate" = "#tmptable"."evaluationdate"
and EMPEVALSCORE."empevaluationid" = empevaluation.empevaluationid
and EMPEVALPROFILEID=12500000008
and EMPEVALCRITERIAID=12500000028);
update #tmptable
set uOthers =(
SELECT EMPEVALRESULT.code
from EMPEVALRESULT,"empevaluation",EMPEVALSCORE
where EMPEVALRESULT.EMPEVALRESULTID=EMPEVALSCORE.EMPEVALRESULTID
and "#tmptable"."employeeid" = "empevaluation"."employeeid"
and "empevaluation"."evaluationdate" = "#tmptable"."evaluationdate"
and EMPEVALSCORE."empevaluationid" = empevaluation.empevaluationid
and EMPEVALPROFILEID=12500000008
and EMPEVALCRITERIAID=12500000029);
update #tmptable
set Category01 =(
SELECT top 1 EMPEVALRESULT.code
from EMPEVALRESULT,"empevaluation",EMPEVALSCORE
where EMPEVALRESULT.EMPEVALRESULTID=EMPEVALSCORE.EMPEVALRESULTID
and "#tmptable"."employeeid" = "empevaluation"."employeeid"
and "empevaluation"."evaluationdate" = "#tmptable"."evaluationdate"
and EMPEVALSCORE."empevaluationid" = empevaluation.empevaluationid
and empevaluation.EMPEVALPROFILEID=12500000002
and EMPEVALCRITERIAID=12500000005);
update #tmptable
set Category02 =(
SELECT EMPEVALRESULT.code
from EMPEVALRESULT,"empevaluation",EMPEVALSCORE
where EMPEVALRESULT.EMPEVALRESULTID=EMPEVALSCORE.EMPEVALRESULTID
and "#tmptable"."employeeid" = "empevaluation"."employeeid"
and "empevaluation"."evaluationdate" = "#tmptable"."evaluationdate"
and EMPEVALSCORE."empevaluationid" = empevaluation.empevaluationid
and EMPEVALPROFILEID=12500000002
and EMPEVALCRITERIAID=12500000006);