.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Post New Web Links

Replace the string after comma starts in MS SQL

Posted By:      Posted Date: September 23, 2010    Points: 0   Category :ASP.Net

Hi All

Could you anybody help me, How to replace the remaining String after the Comma Starts Using SQL Query.  Below is the data

"MediaRights, MediaRightsLink, MediaRightsCompanies, MediaRightsTypes"

EvtBids 1
MediaRights, MediaRightsLink, MediaRightsCompanies, MediaRightsTypes 1
MediaRightsLink 8
SponsorRights, SponsorRightsLink, SponsorRightsBrands, SponsorRightsTypes 3
SponsorRights, SponsorRightsLink, SponsorRightsCompany, SponsorRightsCompanyTypes 1

View Complete Post

More Related Resource Links

String.Replace With wildcard (and use whatever "wildcard" is)

Hello there,I'm hoping someone out there know a way to accomplish what I'm trying to do, because I'm currently stuck :) What I want to do is to replace lets say ##test## with Something(test)..I know that I can find ##test## by: (Though don't know whether there's a smarter way)System.Text.RegularExpressions.Regex.Replace(str, "##Test.*##", "Output")So basically the problem is to get what the wildcard (.*) is, since thats really what I need to know..Anyone with a brilliant idea how to accomplish this?

Replace string in xml without converting to varchar using SQL Server

We have a xml datatype in SQL server which gets a xml file loaded into it. We want to replace some of the content in the xml datatype, but are running into problems converting from xml to varchar(for manipulation purposes), back to xml to output. Does anyone know of a way to replace xml without converting to varchar?Thanks in advance

replace empty string with value if it is empty in ssrs

I need to place a "Days Not Calculated" of the string is empty, if it is not empty then a need to use the days calculated and put "days old" on the end of the number....SSRS 2K5 iif (Fields!AGE.Value, "", "Days Not Calculated")& " Days Old "

what does the @ in string.Replace(@"\'","") do?

hi,can anybody please explain me what does the @ character in the function above do?thanks guys

Comma in viewstate string

Hi, I'm running into following error: "The viewstate is invalid for this page and might be corrupted." "Invalid character in base64 string." Only with IE 8.0.  Firefox works fine. The persisted view state is "/wEPDwULLTE2OTU5NzE1MjYPZBYCAgMPZBYCAgEPZBYCAgMPZBYCZg9kFgQCBQ8WAh4FVmFsdWUFCGRpc2FibGVkZAIHDxYCHwAFCGRpc2FibGVkZGSt4I2szqsXGPwfecanpFW+cIZNhQ==,/wEPDwULLTE2OTU5NzE1MjYPZBYCAgMPZBYCAgEPZBYCAgMPZBYCZg9kFgQCBQ8WAh4FVmFsdWUFCGRpc2FibGVkZAIHDxYCHwAFCGRpc2FibGVkZGSt4I2szqsXGPwfecanpFW+cIZNhQ==" i.e. two identical parts separated by a comma. I'm using a form with both jQuery and UpdatePanel. I've inspected the __VIEWSTATE hidden field before the post __doPostBack and  $I.System.InvokePageMethod.  In both cases the viewstate does NOT contain the comma. Any ideas where the field gets doubled up with the comma inserted? Or how to fix.   Thanks,   D

Replace space from string - REGEX.



I have some problem with RegEx.

I have text:

"something here [tagQuote=Name of Author]bla bla bla[/tagQuote] something here"

And now I want to replace all the whitespace character in quote attribute with "%#%#%#%".

So I want to have: [tagQuote=Name%#%#%#%of%#%#%#%Author]bla bla bla[/tagQuote]

So remove all of the whitespaces between "[tagQuote=" and "]...[/tagQuote]"

I need to replace a big string with more than one value



i need to replace a string like change the dataformat, Uppercase,lowercase e.t.c


Ex: I started this question on Sep/29/2010 till i didn't get any REplay.


This has to be change to ...

I Given this question on 29/9/2010 Still i don't got any replay.



How to solve like this type of issue.

Note : this is not my exact requirement, but it matches similar. My String can consists of minimum 500000 words.


Dividing a comma delimited string


Hi guys,

I am fairly new to TSQL and need some urgent help on this.

I have a column in a table made up of a string that has data as follows:


I would like to break the long string into different words and then store them in separate columns, so I should have

Column 1: COSTS

Column 2: LEVEL

Column 3: GRADE

Column 4: ITEM

Can someone please help me out with this, taking into consideration the fact that I am a newbie to TSQL.


Thank you

replace tab in the string using regular expression

      I want to replace tab space with "|" in the string using regular expressions.
I have tried for

Dim strTabString AS string = "A             B             C "                 
TextBox1.Text = Regex.Replace(strTabString , "\t", "|")
But i m not getting the results.


Specifying a comma separated string as a parameter value in BIDS


Hi, I have a problem that is driving me mad.  I am trying to create a report in BIDS that pulls data from oracle database and generates the report of call it sales by month.  What I'm attempting to do is to create a parameter in BIDS and force a comma separated value into it and then pass that value into SQL statement for an oracle dataset in other words.

BIDS:  Parameter @QTR Paramater label QTR1  Paramter value ('01','02','03')

           Parameter @Year Parameter label Year Parameter value 2010

Oracle side: select * from ....

where year=:Year and

month in :QTR

Whenever I try to run it like that the report generates but it's blank.  Replacing value in QTR parameter with a single non quoted value like 01 generates report perfectly fine.  Could anyone shed some light as to how properly specify comma delimited strings to be used in :in: statements. 

Replacing last comma in string with different character


Hi i have a string, and i want to replace the last comma with something else. For instance this is my string;

"Monday, December 6, 9:00 PM"

How do i replace that last comma so it can look like this;

"Monday, December 6 2010 9:00 PM"

Need help to replace the string


HI Guys,

From the front they are passing some id values
based on those values i want replace my string column

Like .. we have two table 

Table A

Key ID  name 

1     2    aaa  

1     3    bbb 

1     4    xxxx


Table B

Key  Description

1      aaa,cccc,bbb,xxxx,ffff...

we are joining these table based on key value

if They are passing like  2 and 3 from the front so i want replace my descrption column with related name values

in this case i need to display my description like cccc,xxxx,ffff...

When I use 


select replace(description,a.name,'') from table a join table b 

on table a .key = table b.key

and  table a.id in (2,3)

when i write like this it displaying 2 records but iwant display in single records

Please give some suggestions to solve this

Thanks in advance





T-SQL Replace at End of String



Given a String 'This is a test, this is a second test'

Is there an easy method (preferably without using CLR) to search and replace the string to remove the word 'test' but only if it occurs as the last series of characters in a string?

The end result would be

'This is a test, this is a second'



Matching every third word in a comma delimited string.


Hello all,

I have to write a .NET program that accepts a string of comma delimited values.  I want to write a regular expression to accept every third value (starting with the sixth).  I have a regex to skip the first three values and return groups of three:


Now I need something to skip the first two words within each group.  Any suggestions?

Thanks in advance




I have a string like

string str1 = 12345aaaaa~b999~c345678;

I have used str1.Replace("~b999",string.empty);

.contains recognises the substring("~b999") but is not replacing with the empty string as shown.

Any suggestion.



How to replace the comma with a space and a comma



I want to replace the comma with a space and a comma only where the information is not separated by a comma and a space.

test1, test2,(replace)test3,(replace)test4

With this I want to achieve to ensure that information stored in the form: test1,(space) test2,(space) test3,(space) test4

If the comma is separated by a space, the column in the GridView extended.


Replace Escape char in string


Hello all,

I have a following string

"<Grid><IO/>\n<Body>\n<B>\n<I id=\"AR1\" Def=\"R\" Panel=\"\" Id=\"1\" Name=\"Activity 1\" Prent=\"\" ResourceName=\"Emp 1\" S=\"11/26/2010 12:00:00 AM\" E=\"12/16/2010 12:00:00 AM\" Predecessor=\"0\"/></B>\n</Body>\n</Grid>"

And i want it in following form



      <I id="AR1" Def="R" Panel="" Id="1" Name="Activity 1" Prent="" ResourceName="Emp 1" S="11/26/2010 12:00:00 AM" E="12/16/2010 12:00:00 AM" Predecessor="0"/>     





It means i want to replace \ char from upper string. How can i do this. please help.

I am struck very badly. Thanks in advance. please help.

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend