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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 using replace or any other function that can work

Author  Topic 

jjz
Starting Member

31 Posts

Posted - 2010-07-22 : 06:56:56
Hi

I need some assitance

I am trying to get rid of the leading NN/ replacing it with blank, however i am afraid to make use of the replace function, thinking that it will replace the entire field and not just the leading NN/

I would like to use this in an update statement.

below is what i am trying to achieve:

Current:
NN/1676
NN/1679
NN/0292
NN/0293
NN/0946
NN/0702
NN/0617
NN/0581
NN/1855


Ideal Results
1676
1679
0292
0293
0946
0702
0617
0581
1855

Thank you in advance for your assistance.

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-07-22 : 07:09:28
update table
set column=replace(column,'NN/','')
where left(column,3) = 'NN/'



No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

jjz
Starting Member

31 Posts

Posted - 2010-07-22 : 07:30:01
worked like a charm, thank you for your help.

Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-07-22 : 07:30:51
welcome


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -