Search Not Working With String Consisting Of Two Letter

Feb 25, 2007

hi friends,

 I have search in my project based on strings(surname, firstname).. but it does'nt works wen name consists of only two letters.... could somebody please help me on this.

 

Thanks sandeep

View 3 Replies


ADVERTISEMENT

Wild Card Not Working In Search String

Jan 3, 2005

In the below section of code I'm connecing to a SQL database and when I use the "=" in the search it works ok, but when I try to add the ability to use wildcards by changin "=" to "LIKE" its not working

Working code:

Function GetName(ByVal first_Name As String) As System.Data.DataSet
Dim connectionString As String = "server='(local)'; trusted_connection=true; database='FamilyInfo'"
Dim dbConnection As System.Data.IDbConnection = New System.Data.SqlClient.SqlConnection(connectionString)

Dim queryString As String = "SELECT Names.* FROM Names WHERE (Names.First_Name = @First_Name)"
Dim dbCommand As System.Data.IDbCommand = New System.Data.SqlClient.SqlCommand
dbCommand.CommandText = queryString
dbCommand.Connection = dbConnection

Dim dbParam_first_Name As System.Data.IDataParameter = New System.Data.SqlClient.SqlParameter
dbParam_first_Name.ParameterName = "@First_Name"
dbParam_first_Name.Value = first_Name
dbParam_first_Name.DbType = System.Data.DbType.StringFixedLength
dbCommand.Parameters.Add(dbParam_first_Name)

Dim dataAdapter As System.Data.IDbDataAdapter = New System.Data.SqlClient.SqlDataAdapter
dataAdapter.SelectCommand = dbCommand
Dim dataSet As System.Data.DataSet = New System.Data.DataSet
dataAdapter.Fill(dataSet)

Return dataSet
End Function


Code that I would like to work

Function GetName(ByVal first_Name As String) As System.Data.DataSet
Dim connectionString As String = "server='(local)'; trusted_connection=true; database='FamilyInfo'"
Dim dbConnection As System.Data.IDbConnection = New System.Data.SqlClient.SqlConnection(connectionString)

Dim queryString As String = "SELECT Names.* FROM Names WHERE (Names.First_Name LIKE '%' + @First_Name '+')"
Dim dbCommand As System.Data.IDbCommand = New System.Data.SqlClient.SqlCommand
dbCommand.CommandText = queryString
dbCommand.Connection = dbConnection

Dim dbParam_first_Name As System.Data.IDataParameter = New System.Data.SqlClient.SqlParameter
dbParam_first_Name.ParameterName = "@First_Name"
dbParam_first_Name.Value = first_Name
dbParam_first_Name.DbType = System.Data.DbType.StringFixedLength
dbCommand.Parameters.Add(dbParam_first_Name)

Dim dataAdapter As System.Data.IDbDataAdapter = New System.Data.SqlClient.SqlDataAdapter
dataAdapter.SelectCommand = dbCommand
Dim dataSet As System.Data.DataSet = New System.Data.DataSet
dataAdapter.Fill(dataSet)

Return dataSet
End Function


Any help would be greatly appreciated

View 3 Replies View Related

Full Text Search- Substring Search Not Working

Jul 6, 2007

I have Sql server 2005 SP2.
I enabled it for Full Text search. Substring search where i enter *word* doesn't return any row.
I have a table testtable where description has word Extinguisher.

If i run a query with *ting* it doesn't return any row.
select * from testtable where contains(description,'"*xting*"') ;

But it works if i do
select * from testtable where contains(description,'"Exting*"') ;

The Full text search document says it supports substring search.
Is it an issue with sql server 2005?Please help.

View 7 Replies View Related

SQL Server 2008 :: Search Each And Every String In Comma Delimited String Input (AND Condition)

Mar 10, 2015

I have a scenario where in I need to use a comma delimited string as input. And search the tables with each and every string in the comma delimited string.

Example:
DECLARE @StrInput NVARCHAR(2000) = '.NET,Java, Python'

SELECT * FROM TABLE WHERE titleName = '.NET' AND titleName='java' AND titleName = 'Python'

As shown in the example above I need to take the comma delimited string as input and search each individual string like in the select statement.

View 3 Replies View Related

Transact SQL :: Search And Return String After Searched String

Sep 1, 2015

Is there way to search for the particular string and return the string after that searched string

SalesID
Rejection reason
21812

[code]....

The timeout period elapsed hence disqualified

View 3 Replies View Related

Build A Cluster Consisting Of Two Nodes?

Jul 15, 2015

I'm setting up a cluster to test a new deployments of SQL2K14 on a WSFC cluster (W2K12R2). Starwinds VS. the built in iSCSI service?Will either one allow me to build a cluster consisting of two nodes?  Do I need to dedicate a third node to run the iSCSI storage?

View 4 Replies View Related

Who Knows How To Generate A Contents Page Consisting Of Sub Reports?

Feb 13, 2007

Is this possible?, i hope it is:). Your help is very much appreciated.

View 2 Replies View Related

Search Engine Is Not Working

Sep 12, 2002

Swynk have implemented a new search engine on this site. I have found that
whatever I search for it finds nothing. Does anyone know of a work around?

View 2 Replies View Related

SQL Search Results Not Working???

Dec 10, 2005

Can anyone suggest whey I dont get any results with this search?

SQL reads:

SELECT SupplierName, Location, ShortDescription
FROM Query1
WHERE 'TimberSpecies' LIKE '%MMColParam%' AND 'CategoryTable' LIKE '%MMColParam2%' AND 'Location' LIKE '%MMColParam3%'

MMColParam 1 Request.Form("keywordSearch")
MMColParam2 2 Request.Form("location")
MMColParam3 3 Request.Form("category")

Mally.

View 4 Replies View Related

Full Text Search Not Working For Sql2k

Dec 7, 2007

Hi

Issue1:
I have a sql 2k machine. I hav enabled full text indexing on this machine. There after, i inserted and updated so many records. When i do a search using the below query:
It gaves me nothing

select *
from table1
where contains
(
col1,'"keyword"'
)

Issue 2: Another issue is when i gives multiple columns in the below query for search, it throws up a syntax error message at (

select *
from table1
where contains
(
(col1,col2,col3),'"keyword"')
)


Do sql 2k does not allow this format of query(above). But, the same is working fine with one column.

Any inputs on this is highly appreciated.
Thanks!
Santhosh

View 1 Replies View Related

Full Text Substring Search Not Working

Jul 12, 2007

I have Sql server 2005 SP2.
I enabled it for Full Text search. Substring search where i enter *word* doesn't return any row.
I have a table testtable where description has word Extinguisher.

If i run a query with *ting* it doesn't return any row.
select * from testtable where contains(description,'"*xting*"') ;

But it works if i do
select * from testtable where contains(description,'"Exting*"') ;

The Full text search document says it supports substring search.
Is it an issue with sql server 2005?Please help.

View 2 Replies View Related

Challenging Search Task Is Not Working As Expected

Sep 14, 2007



Hi Guys,

I have two tables called table1 and table2.

table1 has search words and table2 has file names as below and want to get file names from table2 those match with all search words.

table1
----------------------
-searchword- column name
--------------------------------------------
Learn more about melons row0
--------------------------------------------
%.txt row1
-------------------------------------------


table2
------------------------------
-testname- column name
--------------------------------------------
FKOV43C6.EXE
-------------------------------------------
frusdr.txt
-------------------------------------------
FRUSDR.TXT
------------------------------------------
SPGP_FWPkg_66G.zip
------------------------------------------
readme.txt
-----------------------------------------
README.TXT
----------------------------------------
watermelon.exe
----------------------------------------
Learn more about melons read me.txt
-------------------------------------------------------


Here is the script what I have tried...............I hope some one will help to come out this loop.Thanks in advance.

===============================================================================


select * from @table2 t2 where t2.[testname] in (

SELECT tb.[testname] FROM @table1 ta

JOIN @table2 tb ON '% ' + tb.[testname] + ' %' LIKE '% ' + ta.searchword + ' %'

group by tb.[testname] having count(*) = (SELECT COUNT(*) FROM @table1)



)
===============================================================================

script to create tables
============================================================================

DECLARE @table1 TABLE (

searchword VARCHAR(255)

)

INSERT INTO @table1 (

searchword

) VALUES ( 'Learn more about melons' )

INSERT INTO @table1 (

searchword

) VALUES ( '%.txt' )



DECLARE @table2 TABLE (

testname VARCHAR(255)

)



INSERT INTO @table2 (

testname

) VALUES ( 'FKOV43C6.EXE' )

INSERT INTO @table2 (

testname

) VALUES ('frusdr.txt' )

INSERT INTO @table2 (

testname

) VALUES ('FRUSDR.TXT' )

INSERT INTO @table2 ( testname

) VALUES ( 'SPGP_FWPkg_66G.zip' )

INSERT INTO @table2 (

testname

) VALUES ( 'readme.txt' )



INSERT INTO @table2 (testname

) VALUES ('README.TXT' )





INSERT INTO @table2 (testname) VALUES (

'watermelon.exe' )

INSERT INTO @table2 (

testname

) VALUES ('Learn more about melons read me.txt' )

SELECT * FROM @table2

DECLARE @table3 TABLE (

testname VARCHAR(255)

)

INSERT INTO @table2 (

testname

) VALUES ('Melon release NOTES 321.xls' )






===================================================================================





View 4 Replies View Related

How To Search This String?

Dec 27, 2004

Hi,
I have an old db with streets names and another one with employees. I have to use both tables to check if an employee adress is ok, but I have the following problem:
Employee adress : 47th street nº12 2nd door b
street in db 47th street

The question is how to say to sql that searchs for the employee street in the streets db cause the employee addres is bigger than any streets in db and I have no results with street like '%47th street nº12 2nd door b%' or something like that.

What can I do?

Thanks so much

View 4 Replies View Related

Search A String

Apr 26, 2002

I have a parameter that is a varchar(50)
and I want to know if there are any percent(%) signs in the string,
what function can I use for this?
I am looking for the T-SQL equivalent of InStr()
Thanks,

View 1 Replies View Related

Help With Search String

May 15, 2008

Hi everybodyI have this query which need to extract names where I use the wildcard character % before and after the string to indicate that the string should not contain these characters but it is not working right .. Is there any way I could do that..SELECT name, famnameFROM inftable WHERE NAME NOT IN ('%socius%', '%rector%', '%superior%')In other words my result should not include those names that contains socius, rector, superior, this characters could begin with or in a middle of the field...thanks

View 2 Replies View Related

String Search

Aug 10, 2007

Hi,

Was wondering how you do the equivalent of an Oracle "Instr" function in TSQL, which returns the position of a string pattern in a specified string? I've looked through all the functions and can't find the equivalent.

Thanks
Simon

View 1 Replies View Related

String Search

Aug 10, 2007

Hi,

Is there a T-SQL equivalent of the Oracle "Instr" function, whereby I can retrieve the position of a one specified charactier string within another? I have looked through the list of string functions and can't find an equivalent, which suprises me!

Thanks
Simon

View 1 Replies View Related

Search String

Apr 25, 2008

For example

I want to search all the people in a database that names mary

I now that the sintax is something that looks like this.

SELECT Id, name
FROM Socios
WHERE (name LIKE '%string%')
But how i input this in the vs2008 query builder for it creates an automatic searchbox toolstrip?

I tried this but it didn't work

FROM Socios
WHERE (name LIKE ?)

View 5 Replies View Related

Cnn String Is Not Working Plz Correct It....

Jan 26, 2007

<add name="NORTHWNDConnectionString" connectionString="Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|NORTHWND.MDF;Integrated Security=True;User Instance=True"            providerName="System.Data.SqlClient" />
 
 
Above is my cnn string that is not working, it might be du to that m using SQLserver standard version ............
Do I have to change the cnn string.?

View 3 Replies View Related

Building Search String ?

Sep 20, 2000

The procedure below is for a 3 field wildcard search window.

It works fine if you enter a value such as cheese in @product_name.
If you enter cheese in @product_name1 or @product_name2 it returns nothing.

The string builds OK with values inserted where they should be, obviously there is a problem in the looping back of variable.

I've been looking at this so long I'm sure that the obvious solution is staring me in the face, but I just can't see it.

Any help would be appreciated.


Alter PROCEDURE usp_RobSearchTest
(
@product_name nVarChar(100),
@product_name1 nVarChar(100),
@product_name2 nVarChar(100),
@country_id nchar (3),
@language_id nchar (2)
)
AS




DECLARE @Variable nVarChar (100)

DECLARE @SQLString NVARCHAR(1000)

DECLARE @ParmDefinition NVARCHAR(1000)





/* Build the SQL string once. */

SET @SQLString =

N'SELECT product_name,unit_price,item_id,refund_price
FROM PRODUCT_LISTING
WHERE product_name LIKE ''%' + @Product_name + '%''
ORDER BY product_name'


/* Specify the parameter format once. */

SET @ParmDefinition = N'@product_name nVarChar (100)'

/* Execute the string with the first parameter value. */

SET @Variable = @product_name

EXECUTE sp_executesql @SQLString, @ParmDefinition,

@product_name = @Variable


/* IT WORKS UP TO THIS POINT */
/* Execute the same string with the second parameter value. */

SET @Variable = @product_name1

EXECUTE sp_executesql @SQLString, @ParmDefinition,

@product_name1 = @Variable

/* Execute the same string with the third parameter value. */

SET @Variable = @product_name2

EXECUTE sp_executesql @SQLString, @ParmDefinition,

@product_name2 = @Variable

View 1 Replies View Related

Search A String Throughout The Database

Mar 8, 2006

Hello
I have a Database which contains like 1000 Tables.
I am not the designer of that DB.So I need to in which table and which column
that string exists. IS there a DBWIDE String search possible?
Thanks and Regards

View 8 Replies View Related

Search String In Reverse

Jul 12, 2002

I need to search a string starting at the end to find the
last space in the string, so I can determine the position of the last word in
the string.
Any ideas on how to do this are greatly appreciated.
Kellie

View 3 Replies View Related

Search For A String In Text

Sep 18, 2007

I am not very familiar with MS SQL, and I need to know how to search a table for a string. I know the column that it is in, but I don't know which record. I am looking for a small piece of text in a much larger text field (we are talkinga maybe a 10k char field and I am only looking for about a 15 char string).

How do I do this with a MSSQL query?

Thanks a bunch


Nevermind, i found PATINDEX(). That worked great.

View 1 Replies View Related

Search For A Column With Certain String

Oct 1, 2013

I have access to a database's web front end and a limited amount of access to the server.

I am trying to find out what column a certain string is in.

I can see some text on the front end via the web that a user enters and then submits. This information must go to the back end of the database but I dont know where it goes...

I am able to provide a unique Sequence number that it would be linked with and obviously I have the string that im looking for its column name but other then that I dont know what I can do.

I don't have write access to the database so I am unable to make procedures. I am also not really aware how the front end works or if I would be able to find the script that deals with the text after the user hits "save"...

View 14 Replies View Related

SQL Search String Function

Jun 2, 2008

The 'LIKE' function looks for words that start with whatever is in the like condition. Is there an sql function similar but will look and compare at any part of the search string.

For example I am using a webservice in dot net to populate a dropdown list using this sql

SELECT compound_name FROM dbo.compound_name WHERE compound_name like @prefixText

In this table there is a compound called SILCAP310 and I would like the search function to pick up 310 if I put this into the @prefix parameter. (but I would still like the search to perform like the 'LIKE' does also.

SELECT compound_name FROM dbo.compound_name WHERE compound_name like @prefixText or compound_name SearchPartString @prefixText

Thanks in advance

View 4 Replies View Related

Search String And Update Row.

Jan 18, 2008

I have at table that I want to update using another table which contains other values than those in the text column.
table1
id: text:
1 1111, 2222, 3333
2 1234, 2222
3 0123

table2
id: str:
1111 aaaa
2222 bbbb
3333 cccc
1234 qqqq
0123 oooo

I want to replace the text in table1 with the new values so that it looks like below:
table1
id: text:
1 aaaa, bbbb, cccc
2 qqqq, bbbb
3 oooo

My first idea was to split the text column in table1 and insert every new text with its id in a temporary table and then concaternate a new string and update the column.
But how do I manage this?

View 4 Replies View Related

Word Search In String

Feb 25, 2008



Hi All,

Please help, it is urgent

I am having a colume as image datatype, in which candidates resume is stored in binary format.
I have to search for particular words for eg. "ASP.Net, 2 Years" into that column
I have converted that column as varchar and then searching above two words(after spliting them by comma) into that string using CHARINDEX


DECLARE @i int, @j int
SET @i = select MIN(ResumeId) from table_name
SET @j = select MAX(ResumeId) from table_name

WHILE (@i <= @j)
BEGIN
DECLARE @Resume varchar(max)
SET @Resume = CAST((select Resume from table_name where ResumeId=100) as varbinary(max))

--code to search the particular word from @Resume

END

It is working fine, but it is very slow, taking 2+ minutes to scan 15000 records
How can I make it faster or is there any other way to search?

Thanks in advance


View 7 Replies View Related

Search Char In String

Jan 11, 2006

Hi

Is there any function to seperate a sting (VARCHAR) into two based on a character in the string (e.g. '-').

In short is there "InStr" or "split" type function in T-SQL ? If not what is the alternative?

I have a column called "Range" (VarChar) in the table which has ranges like 1-14 or 15-49 etc.

I need to select records by compare a variable (numeric) against these ranges.  

So for instace if the variable has 15 its in range 15-49.

I was thinking of spliting the range field into two so that comparison is possible.

Any suggestions?

thanks

 

 

 

View 5 Replies View Related

Connection String For SQL Server Not Working

Mar 17, 2007

I have the Visual Studio 2005 Team Suite trial version and the SQL Server 2005 trial (which came with team suite) installed in my machine.
When I installed the SQL Server 2005 I installed it in the Windows Authentication mode.  So every time I open SQL Server 2005 it doesnt ask for Username/Password (Its greyed out).  The only thing available were:
Server Type: Database Engine
ServerName: ServerSue
Authentication: Windows Authentication.
Here is my Problem:
I created a small application in C#.  In the web.config file I created the following:
<appSettings>
<add key="resumecon" value="SERVER=ServerSue;database=Resume;"/>
</appSettings>
Then in the Code behind I created the following string:
string strResCon = ConfigurationManager.AppSettings["resumecon"].ToString();
Then in  method (for a Login page) I created the connection string as follows and wrote code to insert some values into the Resume database.  I called this method on a button click event.
SqlConnection conLogin = new SqlConnection(strResCon);
When I run the page and when I click the button I get the following error:
Login failed for user ''. The user is not associated with a trusted SQL Server connection.
I think some thing is wrong in the addkey of webconfig?  How do I change this?
 

View 5 Replies View Related

Like Statement Is Not Working When I Pass A String

Mar 23, 2008

Hi,
I have a textbox,in which I am allowing user to write the username starting with,user should enter minimum 3 characters, atleast,and when they enter that information, all the names starting with those 3 characters shouls be shown.can any one help me in this.


my query is:

"select username from registration where username like '" + TextBox1.Text + "%'";

It is working with one char,but if I write more than one character in the textbox,it is not creating any error but it is not returning the result.


View 2 Replies View Related

SQL Query - Search Field For String

Feb 28, 2007

Hi,
I have a SQL server 2005 database with a series of multiple fields. One of the fields has a array of strings seperated by semi-colons like so: Red;Green;Blue
My question is, how can i run a query on all of the fields that have the value of say Green in it. Note that these values vary in different order and numbers.
Thanks

View 2 Replies View Related

Search For A Specific Date When Specified As String?

May 18, 2007

Dear all
 
I am pretty new to SQL server 2005 and have the following issue:
I get the date from the asp applciation in format dd/mm/yyyy and then try to do a search for all records that might match that date in sql server 2005. The date is storred in ther database in datetime format.
I am having trouble composing the stored procedure to do that.
Any help would be apreciated.
Sincerely
d

View 2 Replies View Related

Search String And Extract To Another Table

May 4, 1999

Hi,

Is it possible to search a field in a database, extract CERTAIN data, and insert THIS data into another field in another table?

Example:

Address
---------------------------------------------------
18 BerryWood Drive, Midland, Doncaster, Y09 2JF

I want to extract the postcode from this field into another field in another table....

Example 2:

Name
-----------
Ivor Smith

I wish to strip the last name from the field, and put this into a field in another table..

David

View 10 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved