我有一個查詢下面。我想添加一個條件,如果參數@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