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

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

Parsing Free Text with Ordered Lines

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

What is the best way to parse the ordered text as given in the following T-SQL script? Thanks.

USE tempdb;
DECLARE @EnglishText TABLE (ID INT IDENTITY(1,1) PRIMARY KEY, EnglishText varchar(128))
INSERT @EnglishText (EnglishText) VALUES
('New York City is on the Atlantic'),
('Objct: New Jersey is on the Atlantic Ocean. '),
('Atlantic City is on the Atlantic Ocean. The city's '),
('famous boardwalk is lined with casinos'),
('Yellostone is a National Park.'),
('California is on the Pacific Ocean.'),
('Quito is the capital of Equador.'),
('Objct: Mandalay Bay Hotel Casino is in'),
('Las Vegas. It was the host for a number'),
('of Microsoft conferences.'),
('Mamma Mia is a Broadway musical playing in'),
('the Winter Garden theatre.'),
('In the Heights is a modern'),
('Broadway musical.'),
('Objct: Newport, RI is the "capital" of sailing'),
('on the East Cosst.'),
('It has a famous seaside walk with 100 year-old'),
('Newport's St. Mary's church was'),
('the wedding location of Jacqueline Bouvier to John Fitzgerald Kennedy on September 12, 1953.'),

View Complete Post

More Related Resource Links

Wrap text in Multiple Lines of text column

I had a List created from Calendar. I then took two copies of it to use for two slightly different purposes. I created a View on the list in both cases using the "Newsletter" style. On one of the list the Description column wraps text. In the other one it does not. Any idea what I could have done differently? Is there a checkbox in the View definition or the Column definition that toggles wrap text ?

ASP.net free text search issue for "C#"


In my ASP.net application I have used index server utility to search specific text from word/text files.

For this functionality I have used index server and configured folder. After implementation of this program this was running fine but after some time user reported they can not find keyword "C#" or any word with "#". I think I should share my experience and solution with other developer who may also faced or facing this issue.

Use the following code and it will work.

"Desc" is the text box name and searchstr is the search string paased to index server to search from files.


Desc.Text.contains("C#") Then

searchStr = "C#"


searchStr = Desc.Text.ToLower()


End If

ASP.NET MVC2 Custom routing with wildcard or free text url


I have a requirement to add specific functionality to an asp.net mvc2 web site to provide addtional SEO capability, as follows:

The incoming URL is plain text, perhaps a containing a sentence as follows

"http://somesite.com/welcome-to-our-web-site" or "http://somesite.com/cool things/check-out-this-awesome-video"

In the MVC pipeline, I would like to take this URL, strip off the website name, look up the remaining portion in a database table and call an appropriate controller/view based on the content of the data in the table. All controllers will simply take a single parameter bieng the unique id from the lookup table. A different controller may be used depnding on different urls, but this must be derieved from the database.

If the url cannot be resolved a 404 error needs to be provided, if the url is found but obsolete then a 302 redirect needs to be provided.

Where the url is resolved it must be retained in the browser address bar.

I have had a look at the routing model, and custom routing and can't quite work out how to do it using these, as the controller would not be predefined, based on a simple route. I am also unsure of what to do to provide 404, 302 back to the headers also. Perhpas I need a custom httpmodule or similar but going there went beyond my understanding.

This must be possible someho

Flow Document text parsing to render XML documents with foreground color


I need to display some XML in a flow document in read-only mode. Would like to render it with the black, red and blue formatting based on the contents / keywords. I know you can set the foreground color with span elements.

Is there a way to achieve this in a object oriented / dynamic way ? Like you set the content of flow document/paragraph element and it automatically parses the text and sets the foreground color for specific keywords. I am thinking of starting a prototype project with the help of converters - not sure if it can give an extend-able model (for maybe T-SQL someday). May probably have to inherit from flow document and create a custom / user control.

Any thoughts, help or tips would be greatly appreciated.



How to output data from master detail tables into text file but on different lines.



I have a requirement to output data from two tables, a master table and a detail table, to a text file such that the output looks like the following:

master record 1

detail record  1 1

detail record   1 2

master record 2

detail record  2 1

master record 3

detail record 3 1

detail record 3 2

detail record 3 3



Is this possible in one query?  I am sufficiently familiar with the bcp utility to do the output from any of the tables separately but have some difficulty with doing it for the two tables and have the result structured as outlined above.

Multiple Lines of text



I want to be able to enter multiple lines of text into a field...... but I only want the first 100 chrs to be displayed, but with a link to show the full detail.

E.g. These would be the first few chrs on test but to display the rest you need to click.....more

Is this possible in a Share Point list?

The reason i want this is to enable Issues and Problems to be recorded in a list and the list be used to manage each issue. The notes associated with each issue will build up over time but I want the list to remain easy to read. Therefore I want the full detail of the issue to be on a separate page that is available via a ....more link within the list.


Is this possible?

I'm using Share Point 2010

Free Text Search Behaviour


HI all,

  It would be greatly helpfull to explain the below behaviour in SQL Free text. I have column whose datatype is string and search in that column

 value/Data in the column is "solutions property temperature"

and i am searching using following query

SELECT *   FROM PI_GENERAL(NOLOCK) va JOIN CONTAINSTABLE(PI_GENERAL,name,'"solution property*"') t ON va.id = t.[key]

--  it gives the above record.

when i changed the value to "solutios property temperature" (removed the "n").

i am searching using following query

SELECT *   FROM PI_GENERAL(NOLOCK) va JOIN CONTAINSTABLE(PI_GENERAL,name,'"solutio property*"') t ON va.id = t.[key]

i am not getting the result.

Please some one explain the above behavuiour.


Vijay A


SQL sp_xml_preparedocument - XML parsing error: An Invalid character was found in text content


SQL sp_xml_preparedocument - XML parsing error: An Invalid character was found in text content

I am sending an xml document to Sql Server as text and this error occurs only when sp_xml_preparedocument is called with special characters(öß) in the xml.

 I am using OPENXML to extract the data from the elements to store in tables, however SQL Servers sp_xml_preparedocument cause an exception with special characters.

As a temp fix,
I solved this issue by changeing the sql stored procedure parameter that accepts the XML document to ntext type and changed the table columns type to nvarchar. This allowed the special characters to be inserted without errors into SQL

Required Solution
Do i have any other solution to stayback with my text and varchar datatype rather than using ntext and nvarchar?

http://www.selvaonline.com - Live a Happy & Balanced Life

Free text search in sqlserver


We are having data in in format like 'Ram_Shyam' and this column is full text search enabled.

Now when we do a search on "Ram_Shyam", it brings us the desired record but when we tried to search 'Ram' or 'Shyam' then records having 'Ram_Shyam' are not being populated.


Please help us in this in regard.

Thanks in advance for helping.

Free Code Snippets - ASP.NET

You Can Find Useful ASP.NET Related Posts on the above link.

Free Code Snippets - C#

Free C# Code Snippets

AutoCompleteStringCollection for text box in DataGridView 2.0

I have been searching for a way to have autocomplete in a DataGridTextBox
object. There does not appear to be an obvious way to do this like you would
for a TextBox outside of a grid using the AutoCompleteCustomSource. Any
thoughts on how I can add this collection? :)

Free Series of SharePoint Workflow How-to Videos

This is the series of "How to" Document Workflow with SharePoint using Visual Studio 2008 (using the .NET Framework 3.0 for backward compatibility to Visual Studio 2005). I have created video's that show the most common requests that I have seen around MOSS/SharePoint 2007 workflow & document workflow.

Built-in Functions - Text and Image Functions in SQL Server

Text and image functions operate on TEXT, NTEXT and IMAGE data types. These data types are deprecated with SQL Server 2005 and should be replaced by VARCHAR(MAX), NVARCHAR(MAX) and VARBINARY(MAX) when possible. Alternatively you can also consider storing large string values using XML data type. Text and image functions are nondeterministic.

Future versions of SQL Server will not support TEXT, NTEXT and IMAGE data types. Columns with TEXT / NTEXT data type do not support commonly used string functions such as LEN, LEFT, RIGHT, etc. Furthermore, due to the large size of TEXT data you''re likely to see performance issues if you store such data in the database. However, at times you can''t help but use the TEXT / NTEXT / IMAGE data types (for example when supporting 3rd party databases when you cannot change the schema) - this is when text and image functions come in handy.

Draw lines excactly on physical device pixels

When you draw a line in WPF you will experience that they often appear blurry. The reason for this is the antialiasing system that spreads the line over multiple pixels if it doesn't align with physical device pixels.

Built-in Functions - Text and Image Functions

Text and image functions operate on TEXT, NTEXT and IMAGE data types. These data types are deprecated with SQL Server 2005 and should be replaced by VARCHAR(MAX), NVARCHAR(MAX) and VARBINARY(MAX) when possible. Alternatively you can also consider storing large string values using XML data type. Text and image functions are nondeterministic.

DataTable - Load from IDataReader - CreateDataReader - ReadXml WriteXml - Free ADO.NET Tutorials

The DataTable in ADO.NET 2.0 has been seriously beefed up and I absolutely love it. Not everything we consume deals with multiple resultsets and requires the ever popular DataSet. With the cool new features in the ADO.NET 2.0 DataTable, we can get many of the cool features in the DataSet without all the extra baggage and memory footprint particular to multiple resultsets.

Load DataTable from IDataReader
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