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

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Delimited String Splitter Function with Unknown Delimiter/Rule

Posted By:      Posted Date: October 25, 2010    Points: 0   Category :Sql Server

I am looking for the best T-SQL solution. Hints are just given for problem statement, they should not be used hard-wired in the solution algorithm. Spaces can be trimmed right & left, reduced to single space in middle. It can be assumed that the following ranges are distinquished [a-z], [A-Z], [0-9].  Lookup table support can be added as last resort.

Good luck and thanks.

DECLARE @Delimited TABLE (String nvarchar(256))

INSERT @Delimited VALUES                           

View Complete Post

More Related Resource Links

Can it be done? Delimited String Splitter TVF with Automatic Delimiter Recognition


The request for T-SQL scripts answers located in the following thread:


This thread is not for scripts, it is for discussion.


Kalman Toth, SQL Server & Business Intelligence Training; SQL 2008 GRAND SLAM

Modifying Customizing EditForm.aspx of Doc lib breaks Upload function - Unknown Error

Part of a bigger design issue really. But does anybody know why customizing EditForm.aspx of a Doc lib breaks the Upload function? and how to fix it so it does not. My version of the editform works great, but after an upload I get Unknown Error the resulting url looks like this: https://xxxxx.edu/sites/xxxx/_layouts/Upload.aspx?List=%7b0404432B-91A3-4E18-9202-5954E3A7E0D2%7d&RootFolder=%2fsites%2fmcpharm%2ftest3&Source=https%3a%2f%2fxxxxx.edu%2fsites%2fmcpharm%2ftest3%2fForms%2fAllItems.aspx --- The bigger design issue - disregard if you like: That said, the bigger design issue is we are trying to relate one list row to many documents, but don't want to seperate the docs into seperate folders and would like the solutoin to be seamless. We are going to add a look up from the doc lib to the list, but did not want to use anythng but the List's ID column. However, we do not want users to have to manually look up List row IDs in that form, and we did not want to use a list column that can be edited, even if we can add a unique column policy. My design and thinking is to build a few custom pages with dataviews to show row level details in both lists (1 to many) and a dataview to drive list level functions like edit, delete and upload docs. I think all the pieces are there except for the less than graceful upload function that fist uploads the file and then asks the

Can't pass string to javascript function(unterminated string)

Hello,I have a problem. I can't pass string like this  ": Mar 15 2004 12:00AM  Refnr: 20040315!m>N0"to javascript function because I have symbols like these >, <, % ?tc.Situation:I have a Grid and I have column with DataItemTemplate,Within my dataitemtemplate I have <a href="javascript:void(0);"  onclick="ShowAccountStatementNote(document.getElementById('<%= lblHiddenNoteText.ClientID %>').value);" >                                                          Bekijken...                                                      </a><a href="javascript:void(0);"  onclick="ShowNote('<%# EncodeStringToHTML(Eval("Note")) %>');" > Notes </a>ShowNote function just show popup with text = NoteEncodeStringToHTML do Server.HtmlEncode(); But It doesn't help because even if we change text on server .... e.g. "dfdf%" convert to "dfdf&#37;"  anyway on client it becomes again "dfdf%" and problem still exists.On clien

Can MVC attributes with a string parameter be fed a function returning a string?


Ok so take for instance this attribute:

[PropertiesMustMatch("NewPassword", "ConfirmPassword", ErrorMessage = "La nuova password e la password di conferma non corrispondono.")]

You can see that the third parameter is a string that I would want to localize, hence I would like to delete that message and replace it with a function call, say something along the lines of this:

[PropertiesMustMatch("NewPassword", "ConfirmPassword", ErrorMessage = GetLocalization("strErrPassMustMatch")]

Do you think it would be possible? If I got *any* chance to do it, then good, I will be setting up a system to do this :-P otherwise, I'll have to find some other way :-)

What can you tell me?

Thank you!


Pass string to Javascript function from code-behind...



I'm trying to send a error message to a javascript function from code-behind, but it's not working. When the javascript is executed the output error is: [object Object]

Here's my Javascript:

function Error(error) 
            document.getElementById("<%= errorText.ClientID %>").innerText = error;

And my C#:

        textError = "This is not working!!!";

        ScriptManager.RegisterStartupScript(Page, this.GetType(), "Error", "javascript:Error('" + textError + "');", true);                

Even if i pass the string instead of the 'textError' variable i still get the same error :(

Can anyone help me?

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

C# Insert string from code behind to javascript function


Hi I am using the FullCalendar plugin and I am wanting to load events from the db to the page.

In my codebehind I have a string built up of the events which need to be included.

And I need it to be inserted into the javascript function in the position shown below:

Any help???

For example:

string Calevent = "{ title: 'Click for Google', start: new Date(y, m, 28), end: new Date(y, m, 29),url: 'http://google.com/'}";

$(document).ready(function() {
        var date = new Date();
        var d = date.getDate();
        var m = date.getMonth();
        var y = date.getFullYear();

        var calendar = $('#calendar').fullCalendar({
            header: {
                left: 'prev,next today',
                center: 'title',
                right: 'month,agendaWeek,agendaDay'

How do I write a string coming from a Javascript function in my Label control?


Hi all,

This is what I tried doing in my Javascript function (partially):

catch (err) {
              document.getElementById("lblError").innerHTML = err.description;

IE output of my lblError label component is a long id name like this:

<td>Last Error: <span id="ctl00_ctl00_ContentPlaceHolder_GlobalMasterPage_ContentPlaceHolder_DashboardMasterPage_lblError">No errors at this time.</span>

how do I look up for lblLabel in this case?

Thank you

Public Function Testing (ByVal FirstString as String, ByVal FirstInteger as Integer), how to pass a


I have the following function, sometimes I want to pass a DBNULL.Value to the function so I update the database with a null value, but it won't let me as the DBNULL.Value is not a string or an integer, how can I get this to work?

Public Function Testing (ByVal FirstString as String, ByVal FirstInteger as Integer), how to pass a DBNULL.Value?

' update database

Return value

End Function

T-SQL for getting string function

Hello SQL Experts,

I have a question.... I have 3 tables (table1, table 2 and table3)

ID | meat
1 | beef pork
2 | pork chicken
3 | pork chicken beef


id type
1 beef
2 chicken
3 beef

I have table3.

I am trying to write a t-sql querythat: first it will go to table1 and check for meat column, if the column has beef then it will go to table2 and then pick the ID corrosponding to beef and then add those 2 columns (table2.ID and meat) in table3. if the column has pork, chicken and beef this process should repeate 3 times and add the 3 rows in table3.

My question is how to get the data in meat column and check if it has pork and chicken (or) chicken, pork and beef etc..... is there any string function that I can use in T-SQL. (There is a space between 2 meats types in the meat column).

Please give me some T-SQL syantx for this.

Thank you all so much
--SQL Begineer

Program to find first non repetable character in a string without using any buitin function?


Program to find first non repetable character in a string without using any buitin function?

Using EXECUTE on dynamic SQL string containing scalar valued function with parameters


I would like to use EXECUTE for calling a scalar valued function as dynamic SQL and for assigning the return value to a variable. This is working fine as long as the scalar valued function does not have parameters. E.g.:



@Result bit, @Function nvarchar(MAX)

Combobox basic function. How to add a string as displayname and a string as value?


Hi, I know this is a simple question but i'm stuck...

I have a string = "my string" and I have a valuestring = "12345"

and another string = "my string2" and I have a valuestring = "67890"

and another string = "my string3" and I have a valuestring = "95123"

and so on...

I need a combobox that shows "my string's" and when that is selected a need the value "number" to be saved.


user picks "my string" and my value is "12345"


how do i do that?

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

Need a function to find and format initials in a string


the following rules need to be applied to initials:

- if a two letter initial is required, type them in capitals with no space or stops between them. (eg. BB Construction)

-If a name requires an initials follow it with a space with no stop (eg.  A Sander Davids)

- initials should always be in caps

I need a function that can do the above, any help will be appreciated.


SQL: Stripping HTML tags from a string by calling a function



I have a function that strips HTML from a string. But it lies in a different database to the batabase that is being queried.

My question is: How do i call that function in my query?




Convert comma delimited record to string array


Is there any efficient way to convert a comma delimited record with quotes to string array?

Say, "Peter","Pan",123,"Hello, is it ok",Test
str[0] = "Peter"
str[1] = "Pan"
str[2] = 123
str[3] = "Hello, is it ok"
str[4] = "Test"

That is comma within quotes are not treated as delimited


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