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 |
|
rob41
Yak Posting Veteran
67 Posts |
Posted - 2010-08-27 : 09:45:23
|
| I have a update query i'm working on how do i get - and commas in the query. For example I want my data to be displayed like such:blue-Redford, MI to red-Garden City, MI |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2010-08-27 : 09:53:02
|
UPDATE Table1SET Col1 = 'blue-Redford, MI to red-Garden City, MI' N 56°04'39.26"E 12°55'05.63" |
 |
|
|
rob41
Yak Posting Veteran
67 Posts |
Posted - 2010-08-27 : 10:01:58
|
| here's the code i haveUPDATE [address]SET [address].[Pair] = RTrim([Name]+[City Name]+[State]) + ' to ' + RTrim([Name]+[City Name],[State])FROM [address]WHERE ((([address].[Pair]) IS NULL OR ([address].[Pair]) LIKE ''));I'm trying to get it to update the column pair with Name-City Name, State to Name-City Name, State |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2010-08-27 : 10:09:59
|
Why would you like to have "A B C to A B C"?Are you sure want to travel from one place to same place?UPDATE [Address]SET Pair = RTRIM(LTRIM(Name)) + '-' + RTRIM(LTRIM([City Name])) + ', ' + RTRIM(LTRIM([State])) + ' to ' + RTRIM(LTRIM(Name)) + '-' + RTRIM(LTRIM([City Name])) + ', ' + RTRIM(LTRIM([State]))WHERE Pair IS NULL OR Pair = '' N 56°04'39.26"E 12°55'05.63" |
 |
|
|
rob41
Yak Posting Veteran
67 Posts |
Posted - 2010-08-27 : 11:11:46
|
Thanks it worked |
 |
|
|
|
|
|