我有一个查询下面。我想添加一个条件,如果参数@IsPrestigeFeatured = 0
然后更新IsprestigeFeatured列中的所有其他行<>PropertyId
为0,并且如果@IsPrestigeFeatured = 1
然后IsprestigeFeatured = 1 where propertyId = PropertyId
。更新所有其他记录
我查看了case语句/ if语句,但我似乎无法获得正确的语法。 欢呼
ALTER PROCEDURE dbo.Update_Property
@propertyId int,
@propertyTypeId int,
@Name ntext,
@Price int,
@DescriptionResultsExcerpt text,
@Description ntext,
@Characteristics ntext,
@IsRenovation int,
@IsCharacter int,
@IsPrestige int,
@IsHomepageFeatured int,
@IsPrestigeFeatured int,
@CityId int,
@DepartmentId int,
@CommuneId int
As
UPDATE Property
SET Name = @Name, PropertyTypeID = @propertyTypeId, Price = @Price,
DescriptionResultsExcerpt = @DescriptionResultsExcerpt,
Description = @Description, Characteristics = @Characteristics,
IsRenovation = @IsRenovation, IsCharacter = @IsCharacter,
IsPrestige = @IsPrestige, IsHomepageFeatured = @IsHomepageFeatured,
IsPrestigeFeatured = @IsPrestigeFeatured, CityId = @CityId,
DepartmentId = @DepartmentId, CommuneId = @CommuneId
FROM Property
WHERE (PropertyId = @PropertyId)
什么数据库/语言? MS SQL,mySQL,Oracle? – Ivo 2010-04-12 08:52:57
我正在使用MSSQL – weaveoftheride 2010-04-12 08:59:24