using trim in an update

trying to use trim in an update ... having a problem
update student_info
set rtrim(ltrim(Verify_Name) = FirstName + ' ' + LastName, Diploma_Name = FirstName + ' ' + LastName

 where (Verify_Name = '') and (Diploma_Name = '') and id = 22665
 
select * from student_info where id >= 22665 order by id

Open in new window

HawaiiDragonAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MikeRenzCommented:
update student_info
set Verify_Name = rtrim(ltrim(FirstName + ' ' + LastName, Diploma_Name = FirstName + ' ' + LastName))

 where (Verify_Name = '') and (Diploma_Name = '') and id = 22665
 
select * from student_info where id >= 22665 order by id
0
HawaiiDragonAuthor Commented:
@Mike get an Incorrect syntax near '='
0
MikeRenzCommented:
oops didn't look closely enough at your code....try this instead.

update student_info
set Verify_Name = rtrim(ltrim(FirstName + ' ' + LastName)), Diploma_Name = rtrim(ltrim(FirstName + ' ' + LastName))

 where (Verify_Name = '') and (Diploma_Name = '') and id = 22665
 
select * from student_info where id >= 22665 order by id
0
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

HawaiiDragonAuthor Commented:
when I run it it states 0 rows effected
0
MikeRenzCommented:
do you want every row with ID > 22665 to be affected?  if so, remove the "and id=22665" from the where statement


update student_info
set Verify_Name = rtrim(ltrim(FirstName + ' ' + LastName)), Diploma_Name = rtrim(ltrim(FirstName + ' ' + LastName))

 where (Verify_Name = '') and (Diploma_Name = '')
select * from student_info where id >= 22665 order by id
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MikeRenzCommented:
this will affect ALL rows if you do it the above way.

are you trying to only set the verify/diploma names for id>22665?  or the entire table?
0
HawaiiDragonAuthor Commented:
Yes but each row will have different data in it
0
HawaiiDragonAuthor Commented:
Thank you very much that one worked! I forgot a simple method I put in to catch and clean.... Oh the joys of checks LOL
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2005

From novice to tech pro — start learning today.