From: visweswaran28 via SQLMonster.com on 10 Jun 2010 01:19 Hi, let output string will be, str="01/Mar/2010,02/Mar/2010,03/Mar/2010,04/Mar/2010,05/Mar/2010" Some manipulation Resultant string should be, "01/Mar/2010,02/Mar/2010<br/>03/Mar/2010,04/Mar/2010<br/>05/Mar/2010" Here I want to replace Comma (,) by <br/> Note: I want to replace even commas only. (ie. before 03/mar/2010 & 05/Mar/2010.. like) how can I replace this. -- Message posted via SQLMonster.com http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/201006/1
From: Uri Dimant on 10 Jun 2010 03:26 Use REPLACE function (details in the BOL) "visweswaran28 via SQLMonster.com" <u60654(a)uwe> wrote in message news:a94d6c67d8726(a)uwe... > Hi, > > let output string will be, > > str="01/Mar/2010,02/Mar/2010,03/Mar/2010,04/Mar/2010,05/Mar/2010" > > Some manipulation > > Resultant string should be, > > "01/Mar/2010,02/Mar/2010<br/>03/Mar/2010,04/Mar/2010<br/>05/Mar/2010" > > Here I want to replace Comma (,) by <br/> > > Note: > > I want to replace even commas only. (ie. before 03/mar/2010 & > 05/Mar/2010.. > like) > > how can I replace this. > > -- > Message posted via SQLMonster.com > http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/201006/1 >
From: Erland Sommarskog on 10 Jun 2010 16:45 visweswaran28 via SQLMonster.com (u60654(a)uwe) writes: > let output string will be, > > str="01/Mar/2010,02/Mar/2010,03/Mar/2010,04/Mar/2010,05/Mar/2010" > > Some manipulation > > Resultant string should be, > > "01/Mar/2010,02/Mar/2010<br/>03/Mar/2010,04/Mar/2010<br/>05/Mar/2010" > > Here I want to replace Comma (,) by <br/> > > Note: > > I want to replace even commas only. T-SQL is not really the best language for the task. I would suggest that your best choice is to write a CLR function for the task, if you absolutely need to this in SQL Server. But it is definitely better to do client-side, as SQL Server should not be bogged down with presentation details. -- Erland Sommarskog, SQL Server MVP, esquel(a)sommarskog.se Links for SQL Server Books Online: SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
|
Pages: 1 Prev: SQL05 Cluster: Striped tempdb reverting to original non-striped? Next: Am I UNICODE ? |