This Domain(Admin5.com) is for Sale:

Ultradev专题使用数据库存储过程给子表格增加多个记录

时间:2007-12-23  来源:不详  作者:迈克DB

@StartDate [datetime], @CloseDate [datetime], @JobDescription [varchar](4000),
@Qualifications [varchar](4000), @SalaryBenefits [varchar](4000), @Resp
[varchar](4000), @Availability [varchar](200), @ToApply [varchar](2000),
@EmailJobs [varchar](100), @CategoryID [varchar](100), @PopulationID
[varchar](100), @JobID [int] OUTPUT)
AS
-- Insert into Jobs table

INSERT INTO Jobs

([CompanyID], [JobTypeID], [RegionID], [JobTitle], [StartDate], [CloseDate],
[JobDescription], [Qualifications], [SalaryBenefits], [Resp], [Availability],
[ToApply], [EmailJobs]) VALUES (@CompanyID, @JobTypeID, @RegionID, @JobTitle,
@StartDate, @CloseDate, @JobDescription, @Qualifications, @SalaryBenefits, @Resp,
@Availability, @ToApply, @EmailJobs)

-- Retrieve the automatically generated JobID VALUE from the Jobs table

SET @JobId = @@IDENTITY

-- Insert new values into JobCategory table

DECLARE @CatInsert varchar(2000)

SET @CatInsert = 'INSERT INTO JobCategory (JobID, CategoryID) SELECT '

copyright dedecms


CONVERT(varchar,@JobID) ', Category1ID From CategoryType Where Category1ID IN ('
@CategoryID ')'

exec(@CatInsert)

-- Insert new values into JobPopulation table

DECLARE @PopInsert varchar(2000)

SET @PopInsert = 'INSERT INTO JobPopulation (JobID, PopulationID) SELECT '
CONVERT(varchar,@JobID) ', PopulationID From Population Where PopulationID IN ('
@PopulationID ')'

exec(@PopInsert)

Return

   asp">存储过程

看完这篇,您有何感觉呢?

文章评论

共有位Admini5网友发表了评论 查看完整内容

24小时热门信息