<div dir="ltr"><div dir="ltr">Dear Micha,<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jun 17, 2020 at 4:05 PM Micha Silver <<a href="mailto:tsvibar@gmail.com">tsvibar@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<br>
<div>On 17/06/2020 16:14, Margherita Di Leo
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div>Ciao Stefan,</div>
<div><br>
</div>
<div>thank you, I tried and it didn't give me any error but
didn't update the column either...<br>
</div>
</div>
<br>
</blockquote>
<p><br>
</p>
<p><br>
</p>
<p>The sqlite CASE statement should be:</p>
<p>CASE <old_column> WHEN '<old_val1>' THEN
'<new_val1>' WHEN '<old_val2>' THEN
'<new_val2>'....END;</p>
<p><br>
</p>
<p>Here's an example that worked for me. I have a "myroads" vector
with column 'TYPE'</p>
<p><br>
</p>
<p><font size="+1"><tt># Add new column for road width as text</tt><tt><br>
</tt></font></p>
<p><font size="+1"><tt>v.db.addcolumn myroads column="width TEXT"</tt></font></p>
<p><font size="+1"><tt># Run update with CASE</tt></font></p>
<p><font size="+1"><tt>db.execute sql="UPDATE myroads SET width=CASE
TYPE WHEN 'Main' THEN 'Wide' WHEN 'Local' THEN 'Narrow' ELSE
'Unknown' END;"</tt></font></p>
<p><font size="+1"><tt><br>
</tt></font></p>
<p><font size="+1">Best, Micha</font><font size="+1"><tt><br>
</tt></font></p></div></blockquote><div>This worked! Thank you so much! I have one last question. Does it also support an IS LIKE condition, and if yes, how can I express it?</div><div><br></div><div>Thanks!<br></div></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><font color="#666666">Margherita Di Leo</font></div></div></div></div></div></div></div></div></div></div>