November 23, 2013 at 8:45 am
I am trying to write the correct syntax for adding a dash to everything in a specific field.
The query I came up with:
update table1
set field1 = '-' & [field1]
from table1
syntax works in access but not SQL SERVER 2008. I need the SQL 2008 syntax. Please help
original data in field
field1: 1 Result I need: -1
November 23, 2013 at 9:15 am
Hi
use this below syntax.
update table1
set field1 = '-'+Field1
--with where condition
update table1
set field1 = '-'+Field1
where field2 =1 0
November 23, 2013 at 10:49 am
the field is an integer and will not update with a dash. Is there a conversion I have to do?
November 23, 2013 at 1:29 pm
update table1
set field1 = Field1 - Field1 * 2
It should work some extent.
November 24, 2013 at 5:06 am
SampathKumarM (11/23/2013)
update table1set field1 = Field1 - Field1 * 2
It should work some extent.
That seems the hard way to do
update table1 set field1 = 0 - field1;
(or even just = - field1).
Tom
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply