Sql 使用liquibase更新表中的一行
我希望有人能验证这是否是使用liquibase填充DB的正确语法和方法?我只想更改表中一行的值,我是这样做的:Sql 使用liquibase更新表中的一行,sql,database,liquibase,Sql,Database,Liquibase,我希望有人能验证这是否是使用liquibase填充DB的正确语法和方法?我只想更改表中一行的值,我是这样做的: <changeSet author="name" id="1231"> <update tableName="SomeTable"> <column name="Properties" value="1" /> <where>PROPERTYNAME = 'someNameOfThePropery"</where&g
<changeSet author="name" id="1231">
<update tableName="SomeTable">
<column name="Properties" value="1" />
<where>PROPERTYNAME = 'someNameOfThePropery"</where>
</update>
<changeSet>
PROPERTYNAME='SomeNameOfProperty'
我只想在某个表中更改一行中的一个值。尽管应用程序已编译,而且它没有抱怨,但上述操作不起作用,但是,唉,值没有更改
谢谢是的,这是可能的。请参阅以下语法:
<changeSet author="name" id="1231">
<update catalogName="dbname"
schemaName="public"
tableName="SomeTable">
<column name="Properties" type="varchar(255)"/>
<where>PROPERTYNAME = 'someNameOfThePropery'</where>
</update>
</changeSet>
PROPERTYNAME='SomeNameOfProperty'
以上帖子的更多信息可以通过这种方式修改为正确的格式。Inserted value=“1”这是本文问题的预期结果
<changeSet author="name" id="1231">
<update catalogName="dbname"
schemaName="public"
tableName="SomeTable">
<column name="Properties" **value="1"** type="varchar(255)"/>
<where>PROPERTYNAME = 'someNameOfThePropery'</where>
</update>
</changeSet>
PROPERTYNAME='SomeNameOfProperty'
以上答案过于复杂,在大多数情况下,这就足够了:
<changeSet author="name" id="123">
<update tableName="SomeTable">
<column name="PropertyToSet" value="1" />
<where>otherProperty = 'otherPropertyValue'</where>
</update>
</changeSet>
otherProperty='otherPropertyValue'
重要的是在WHERE子句中使用单引号而不是双引号。WHERE元素的结尾处有一个“而不是一个”。上面的操作不起作用,因为您没有设置值字段。因此它不会给出适当的结果。最后一个结果在下面的帖子中指出。