Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
pmp7798
Starting Member
2 Posts |
Posted - 2013-11-23 : 11:09:24
|
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 table1set field1 = '-' & [field1]from table1 syntax works in access but not SQL SERVER 2008. I need the SQL 2008 syntax. Please helporiginal data in fieldfield1: 1 Result I need: field1: -1paul pearson |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-11-23 : 11:40:10
|
+ is the concatenation operator in sql serverupdate table1set field1 = '-' + [field1] ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
pmp7798
Starting Member
2 Posts |
Posted - 2013-11-23 : 12:28:11
|
What if field1 is an int field? do I have to do a conversion?paul pearson |
|
|
djj55
Constraint Violating Yak Guru
352 Posts |
Posted - 2013-11-25 : 08:07:24
|
If you have an integer column try multiplying by -1.djj |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-11-25 : 09:27:09
|
quote: Originally posted by pmp7798 What if field1 is an int field? do I have to do a conversion?paul pearson
wats your attempt? to make it negative?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|