.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

How to Find a specific sentence in a table that contains only words?

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

Hello dear grurus,

I don´t know if my question did, somehow, explain itself... if not, let me brake it down:

I have a table like this:

ID         WORDS

1          change color red

2          open door

3          find terms


now, I would like to search for an ID giving this search string: "Whould you like to change the color to red, please?"

please notice I have given a sentence containing 3 keywords found in row 1 for the table above... I know this, but how do I make t-sql to know this? 


Thank you so much for the help guys!

PS: please let me know if im not clear enough.

View Complete Post

More Related Resource Links

How can I find from a single query that a user has which permission on a specific table


Hi All,

How can I find from a single query that a user  has which permission on a specific table. I have a Table named "Property_Address" and a User "ABC" doing update on this table. How can I revoke permissions on this table from this user and how can I find which permissions this user have on Property_Address Table.

Any help would be appreciate.

How to find misspelled words with regex

Hi all I need a RegEx that will find a specific word within a long string. The issue is that this word may be misspelled and I need to find it even so. I would like to accept a certain percentage of wrong-ness when looking for the word. Ex. The complete string: Hello, this is my comp/et string to look at The word to search for: complete Let's say that I which to accept a maximum of two wrong letters in the above string, then the RegEx should match the word complete. However, if I only accept 1 wrong letter it shouldn't find it. Ideally the RegEx would also be able to handle whitespaces, and missing letters. Ex: The complete string: Hello, this is my com plee string to look at The word to search for: complete This should match the word as well, even though there is a whitespace between 'm' and 'p' and the letter 'l' is missing. Is this possible at all with RegEx or should I be looking at an alternative way to solve it? Thanks, Tommy

DTA doesn't find referenced table form stored procedure with SP_executesql

Using the SQL2008R2 profiler and DTA connected to a SQL2000 server. I created a tuning tracefile with profiler for a certain db on the sql2000 server because I need to tune 1 table in the database referenced by 3 parameterized stored procedures which built a query depending on the parameters and is executed with an sp_executesql statement. When I run the DTA loading the tracefile I see the exec stored procedure events with it's parameters and the message Event does not reference any tables. And that's it. The DTA generates no Recommendatioin at all. How can I get the exact sql statements in the tracefile so the DTA can do what he needs to do? Regards

I have 3 triggers defined on an sqlserver2008 table and I can't find them with c#

I've got the code below and when I run it, it always says there are 0 triggers in table.Triggers.  I added some debugging code checkin the table.HasDeleteTrigger, etc. and from that, I get the exception: "To accomplish this action, set property HasDeleteTrigger." when I try to set it to bool hasDeleteTrigger. I can get stored procedures find, just not triggers. Below is my problem code: foreach (Database database in databaseCollection) { if (database.Name.Equals(catalogName)) { // first we need to delete triggers associated with all tables that begin // with our prefix. we can skip our the framework tables because those // don't have triggers on them // grab all tables, filter for non prefixed ones in foreach loop so we can delete triggers from non prefixed ones results.AddRange(from Table table in database.Tables select table.Name); foreach (var tableName in results) { var table = new Table(database, tableName, CrSyncDbSchemaName); table.Refresh(); bool hasDeleteTrigger = table.HasDeleteTrigger; bool hasAfterTrigger = table.HasAfterTrigger; bool hasInsertTrigger = table.HasInsertTrigger;

Cannot find table 0

Hope someone can help.  When the page loads I am able to click the add button and it moves the selected person from one dataset to the next.  If I then try to move another person I get the error message 'Cannot find table 0'.  I have changed the text to bold where the error occurs. Here is my codestring sourceUser = (string)HttpContext.Current.Session["TargetUserID"];System.Data.DataSet blank = new System.Data.DataSet();System.Data.DataSet ds = new System.Data.DataSet(); protected void Page_Load(object sender, EventArgs e){ if (lstCopyTargetUsers.Items.Count < 1) { if (Page.IsPostBack) { Sage.Platform.Data.IDataService service = Sage.Platform.Application.ApplicationContext.Current.Services.Get<Sage.Platform.Data.IDataService>(); string connStr = service.GetConnectionString(); Sage.SalesLogix.Security.SLXUserService usersvc = (Sage.SalesLogix.Security.SLXUserService)Sage.Platform.Application.ApplicationContext.Current.Services.Get<Sage.Platform.Security.IUserService>(); Sage.Entity.Interfaces.IUser user = usersvc.GetUser(); string loggedinid = user.Id.ToString(); System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection(connStr); conn.Open(); System.Data.OleDb.OleDbCommand reps = new Syste

I have added new fields to a table in SQLserver, why could not find these new fields in Analysis Ser

I have added new fields to a table in SQLserver, why could not find these new fields in Analysis Services database source view?  My version is 2005.

Duplicate records find in table

  Hi ALL, I want to find the dynamically check the primary key values and remove the duplicate records.. please suggest it.   Regards Ram

Find text between two separate words - to parse text from a message

Hi all, I am new to regular expressions.   The following text has got three sections; - Name, Date, and Message   [Sender]: John Smith  [Received]: 2005-8-21 3:28:9Hi bob, thanks for the message[Sender]: Paul Stein  [Received]: 2005-8-21 3:17:38Cannot make that time...[Sender]: Sarah S  [Received]: 2005-8-20 15:18:2No way! Let me know if it's on. I would love to see that film. It got great reviews.[Sender]: John Smith  [Received]: 2005-8-21 3:28:9Hi bob, thanks for the message[Sender]: Paul Stein  [Received]: 2005-8-21 3:17:38Cannot make that time...[Sender]: Sarah S  [Received]: 2005-8-20 15:18:2No way! Let me know if it's on.   I want to extract each of them.   The text between "[Sender]:" and  "[Received]:" is the NAME   The next word after the  "[Received]:"  is the DATE   The MESSAGE starts after the digits of the Date end and it is upto the mark  "[Sender]:"   Can anyone tell me how to extract it using C# Regular expressions.   Thank you for your time.   Tomy

Display specific table from the start vs selecting from a list.

Hello all, I'm using VS2010, EF 4.0. I want to display a list view from a specific table from the start -instead of the standard default page that list all the tables. Any ideas are welcome. 

populate specific data from table

I am trying to build an application.I have table in my database named tbl_customer.I am able to display all the customers information using MVC i.e Name,Designation, Address, PhoneNumber, Sex etc.Now I Want To Display Customer only Having Sex "Female" (Sort Out Data From tbl_customer)How I Can Do This???I Am New To Asp.net.. I Am Using VS 2010, SQL Server 2005Help In This Context, Appreciated In Advance..Regards

How to find specific nested object type in Gridview

Dears, I have a gridview with a nested placeholder in each rows. I nested some checkboxes in each placeholders in each rows dynamically, so their ServerIDs are not the same (I dont want to use nested gridview). at the end in a button event I want to count checked checkboxes in gridview while I can not use findcontrol() method in each rows to find checkboxes due to their different ServerIDs. How can I do this?

Want to show FormView in Edit mode with specific table columns depending on their Genre??

hi, I have  a table in my database called "Profiles". This holds data on Female and Male personal characteristics. On my aspx, I have a formview in edit mode which is binded to an object data source with a GetDataByUserId Select method which retrieves data from the "Profiles" Table via a DAL. The "Profiles" table has some columns which relates to females only and some just males and some are generic to both. See example below     UserId - / of Type GUID GenreId /  of Type BOOL. Hip Size (For females) Dress Size ( For Females) ChestSize (For Men ) TrouserSize (For Men) Weight ( For both )   When the User logs in , they go to an update Page which has the Formview in Edit Item Mode and contains drop down Lists which are binded to the Users Selected Value. The DDL are in turn bound to their related table such as HIP, Dress, Chest, Trouser etc. Objective If a female user logs in I just want to show them the (Hip Size) DDL  and DressSizeDDL in the Edit item template of the formview and not the ChestSize DDL or  TrouserSize DDL. At present the GetProfileByUserId returns all colums from the table My question is how do I do this and just show DDL which are relevant to the Female or Male Only. In some cases the user may not have selected an item in the previous form so they could also be

Cannot find Table 0

Hi all! Having a bit of an issue here where I'm getting the error "Cannot Find Table 0" when executing an INSERT INTO sql statement. The fishy part is that the code half works -- the new information is submitted to the database. Here the code in question:Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Request.Form("TextColContent") = "" Or Request.Form("TextColTitleEN") = "" Or Request.Form("TextColTitleFR") = "" Then 'This is to display the information in the text areas (from database) Dim rst1 'As New DataTable Dim rst2 'As New DataTable Dim rst3 'As New DataTable rst1 = ExecSQLSelect("SELECT Top 1 News_Item_Content FROM r_BI_Welcome_News ORDER BY News_Item_ID DESC") rst2 = ExecSQLSelect("SELECT Top 1 News_Item_Title_EN FROM r_BI_Welcome_News ORDER BY News_Item_ID DESC") rst3 = ExecSQLSelect("SELECT Top 1 News_Item_Title_FR FROM r_BI_Welcome_News ORDER BY News_Item_ID DESC") formOpen.Text = "<FORM Action='add_news.aspx' Method='Post'>" textarea1.Text = "<TEXTAREA Rows=1 Cols=48 Name='TextColTitleEN'>" & rst2.Rows(0)("N

Find all tables that depend on table with FK column

I need to write a stored procedure that when passed the id of a row on a table, will query all tables that are referencing that row and move the data to another row.  I am doing this because we have 2 seperate systems that are linked by a table and sometimes things get out of whack and you have to manually move information over. I have this query that can find all the dependent tables, my question is what would I add to this to obtain the name of the column that is the foreign key on that tables.  SELECT o.name[parentTable], o2.name[childTable] FROM sys.sysobjects o INNER JOIN sys.sysforeignkeys fk ON fk.rkeyid = o.id INNER JOIN sys.sysobjects o2 ON o2.id = fk.fkeyid AND o2.id <> o.id WHERE o.name = 'tablename' I want to do this as a query because I want the procedure to be able to detect any new tables that might have been added.

select 15 words(not character) from table


i want to select only 15 words from table  , plz reply me how can i do this???

How can I avoid error a Insert Store proc if he don't find any coloum in a table


I have created one Insert Proc for a table which has three Colourm. 

Id int, [Name] varchar (30), Phone varchar (15) I want to use this proc for another Table which has two coloum which is semiler with first table lie   Id int, [Name] varchar (30) I want to use one Insert Store Proc For two Table. I can avoid null value of parameter but but can't avoid if the coloum is not exist. 



Find '' in a table in MS SQL SERVER 2008



I need to find white spaces in my table. the table contains 35 columns, therefore, I cannot check with AND or OR operator something like this

SELECT * FROM MS_Exchange_IS WHERE (TMZDIFF != '' AND Timestamp != ''..........)

Also I don't want to use cursors as it will greatly hamper the performance of my application.

Please suggest any other option.


Any link or pointers would be helpful


Thanks in Advance,

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