Solved

Replace

Posted on 2011-03-25
8
258 Views
Last Modified: 2012-05-11
Hi all,

Please find the attachment,

I have a requirement where I need to replace the ISDN values into PRI from the Tag Column
I guess we have something like this select replace([tag_col],'ISDN','PRI') from tablename. this works fine.

I have another requirement where rest of the values in the tag_col should go null/blank.
It means I should have tag_col with 'PRI'  only.

please help out.
thanks in adv
test.xlsx
0
Comment
Question by:parpaa
  • 3
  • 3
  • 2
8 Comments
 
LVL 4

Expert Comment

by:RGBDart
ID: 35214171
just add

where replace([tag_col],'ISDN','PRI') = 'PRI'
0
 
LVL 4

Expert Comment

by:RGBDart
ID: 35214182
[telepathy mode = on]
May be you want update items in that table, not select from it?
[telepathy mode = off]
If yes, query will be different
0
 

Author Comment

by:parpaa
ID: 35216374

@RGB many thanks for your sugg,
What if I want to update the table?? how the query will be?
0
 
LVL 32

Expert Comment

by:ewangoya
ID: 35220059


update table
set tag_col = 'PRI'
where tag_col = 'ISDN'
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:parpaa
ID: 35221546
UPDATE TABLE
SET TAG_COL ='PRI'
WHERE TAG_COL='ISDN'

what if I want rest of the records in the TAG_COL column be null ?
0
 
LVL 32

Assisted Solution

by:ewangoya
ewangoya earned 200 total points
ID: 35221869
Update table
Set tag_col =null
Where tag_col <> 'PRI' and tag_col <> 'ISDN'
0
 
LVL 4

Accepted Solution

by:
RGBDart earned 300 total points
ID: 35222234
first queries written by ewangoya and parpaa will replace values in tag_col column from ISDN to PRI. All the other row (not ISDN) will remain unchanged.

the last one will set tag_col  = null for all records that are not PRI and not ISDN
0
 

Author Closing Comment

by:parpaa
ID: 35223005
Highly appreciated for your efforts and suggestions. Thank you so much.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

     When we have to pass multiple rows of data to SQL Server, the developers either have to send one row at a time or come up with other workarounds to meet requirements like using XML to pass data, which is complex and tedious to use. There is a …
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now