INDEX Possible For Reverse Wildcards?

Jul 20, 2005

If I use _reverse_ wildcard search will it always result in a table
scan? Is it possible to get the DB (Oracle or SQL server) to use
indexes when doing reverse wildcard match?

let's say I have:

table email_address (id int, email varchar)

with the following entries

2, www.%shoes.%
3, w%.super%shoes.%
4, %webbox.somecopany.com

select id from email_address where 'www.superdupershoes.com' like
email;

this returns 2,3

But the query always results in a table scan even if I add an index to
email. What kind of index can I employ in this situation?


Please note that this is a _reverse_ search, the opposite of what's
normally done, i.e. select from email_address where email like
'www.%shoes.com'.

Thanks!

- Robert

View 9 Replies


ADVERTISEMENT

Sql && Wildcards

Jan 22, 2007

HelloI am trying to search 2 columns on a databsae table  using a string put into a box, the code i have at the moment is SqlConnection conn =                        new SqlConnection(SqlDSFindPost.ConnectionString);        SqlCommand cmd =          new SqlCommand            ("SELECT * FROM tblBlog WHERE UserName LIKE @UserName OR Title LIKE @Title; ", conn);        cmd.Parameters.Add("@UserName", SqlDbType.NVarChar, 50).Value = '%' + TextBox1.Text + '%';        cmd.Parameters.Add("@Title",SqlDbType.NVarChar, 50).Value = '%' + TextBox1.Text + '%';        conn.Open();        cmd.ExecuteNonQuery();        GridView1.DataBind(); I have tried all sorts of strings and even typeed the string directly into the parameter but never get any results, yet when i type the wildcards directly into the textbox i get the correct rows returned. Can anybody see anything wrong with my code  and tell me where i am going wrong, or alternativly point me in the direction of some c# code for searching a database similar to the search box abovei dont do a lot in asp or c# so this is driving me crazy  Thanks for looking 

View 2 Replies View Related

USING WILDCARDS

Jan 19, 2005

Does anyone know how I could show all the records of tools with the word released after them? For example, 'Volume Monitor 4.4 Released'

I tried this statement with no luck:
Select * from Issues where Tools LIKE 'RELEASED %'

Thanks,
Russ

View 6 Replies View Related

Using Wildcards

Feb 24, 2000

I have a need to use wildcards in a sql statement. e.g. select * from tbl where field='%computer%'.
How can I substitute the string "computer" for a variable declared in the stored procedure.
Procedure Sample
@Str varchar(50)
AS
select * from tbl where field = '%' & @Str & '%'
(How do incorporate the wildcard variable @Str?

View 2 Replies View Related

Wildcards In BCP

Apr 21, 1999

I am running the data import below in a stored procedure:

EXEC xp_cmdshell "bcp TCCSTGB..TGB_Fimport in d:MSSQLTGB_ImportsNNNYYYYMMDDHHMM.SDF /f d:mssqlFormatsTGB_Fimport.fmt /Usa /P ", no_output

I want to replace the NNNYYYYMMDDHHMM with a wildcard (for example *), so that import will pull ANY .SDF files in, but it will not run. i get the following:

output
------------------------------------------------------------------------------
DB-LIBRARY error:
Bcp: Unable to open host data-file.

View 1 Replies View Related

Using Wildcards %

Nov 1, 2007

Hi

I need to replace the use of wild cards in my query with something else which achieves the same thing. The problem is the web application which uses the query does throws an error when using '%' characters. Any ideas?

The following statement appears in the where clause:

AccType.Value like '@Opened_By[%DIST%APP% as Distance and Business Provider, DIST% as Distance, APP% as Business Provider]'

Thanks

View 1 Replies View Related

Reverse Equivalent To TOP

Dec 28, 2006

Is there anyway I can return only the last row of a query, like TOP does for the top most items?I would like to return something like this:SELECT BOTTOM 1 Column_CFROM Table1WHERE Column_A = somethingAny help would be greatly appreciated.  Thank you!  

View 3 Replies View Related

Reverse Engineer

Aug 10, 2000

1. Is there a stored procedure, or a way to reverse engineer a database in SQL Server 6.0?

2. I need to create a recovery system for all datbases. I know SP_HELP_REVDATABASE dbname
works for sql server 6.5 but does not for sql server 6.0

Thanks
Rajiv

View 1 Replies View Related

Reverse Engineering SPs

Mar 8, 1999

Does anyone know of a way to determine the code of a stored procedure that was built with encryption? I inherited a db with many of these and we are not sure which version of the source code exists on the server. Alternatively, can I compile a new SP and compare it to the old one in any way other than testing lots of data?

thanks in advance.

View 1 Replies View Related

Reverse Order By?

Mar 28, 1999

If I want to query the db and pull the records in reverse how can I do that?

Here, It looks something like this.

sql = " SELECT "
sql = sql & "ID, from_, subject, comments, "
sql = sql & "msgtime, msgdate, repto, followups "
sql = sql & "FROM " & TABLE_NAME & ""
sql = sql & " WHERE (repto < 1);"
sql = sql & " Order by ID" <-I want to get this starting with the largest ID #

Any Idea's?
Thanks in advance.
Mike

View 1 Replies View Related

Reverse Cross Tab

Feb 19, 2002

Is is possible to write a query that does the reverse of a cross tab query, I have a table that is mirrored for our Main frame, the table contains a item number a warehouse number and a date field and then 43 fields like field01 thru field43 which store quantities, each field out from 01 is another date our from the date field and I need to look for the item, warehouse and return a date where one of the many field is greater than or equal to the quantity I am looking for, I obviously will have to calculate the date field but thought If I could do the reverse of a cross tab giving a resuld set of 43 records for everyone in the first file I could do a quick update for item number, warehouse match and quantity field greater than what i need returning the date

blah blah blah , sorry I made it sound so confusing

THANKS IN ADVANCE

View 2 Replies View Related

Reverse Formula

Feb 12, 2008



Hi . My database seems to be somehow encrypted by the software I used. When I try to export my data some fields are encrypted like this:


1 => 31911
2 => 63758
3 => 95540
4 => 127258
5 => 158912
6 => 190504
7 => 222032
8 => 253498

I'm really sure it's not some complicated formula (because I managed to recover other fields) . I just want to reverse the formula used to "encrypt" this data.
Thank you. Excuse my english.

View 1 Replies View Related

Sql Case With Wildcards ???

Mar 28, 2007

Hi,
 
I’m trying to use case statement in my view with wildcards for '%Tradies%', instead of listing all items      
 
WHEN 'Tradies Rebate1' THEN 'Test'
WHEN 'Tradies Rebate2' THEN 'Test'
WHEN 'Tradies Rebate3' THEN 'Test'
WHEN 'Tradies Rebate4' THEN 'Test'
 
At this moment '%Tradies%' does not work and gives me null values in EventGroup column.
 
Here’s my statemnt
------------------------------------------
CASE [dbo].[Event].[EventName]
      --WHEN 'Tradies Rebate1' THEN 'Test'
      --WHEN 'Tradies Rebate2' THEN 'Test'
      --WHEN 'Tradies Rebate3' THEN 'Test'
      --WHEN 'Tradies Rebate4' THEN 'Test'
      WHEN '%Tradies%' THEN 'Test'
      WHEN 'Install Products' THEN 'All Installed'
      WHEN 'Installation Product Conversion' THEN 'All Installed'
      WHEN 'Installation Products' THEN 'All Installed'
      WHEN 'BK 3' THEN 'All Bright Kids'
END AS [EventGroup],
------------------------------------------
 
 
 
Please help!!!
 

View 4 Replies View Related

How To Use Wildcards In WHERE Clause

May 5, 2004

I have a SQL statement which is generated dynamically. I need to know what is the correct syntax for this

WHERE status = 'open' AND salesman = * AND dat = * AND customername = *

i.e. fetch everything WHERE status = 'open'

I know that simply WHERE status = 'open' would do the trick but I need it like the first example because of the way the statement is being generated i.e. this salesmen bit is like this.

If Salesman <> "*" Then
sql2 &= " AND salesman = '" & Salesman & "'"
Else
sql2 &= " AND salesman = *"
End If

Thanks

Ben

View 2 Replies View Related

Wildcards In Words

Apr 28, 2005

Hi I'm using the full-text indexing on a table and I'm trying to implement a search where users can search for words and use wildcards themselves. However I'm working on a method so that can enter a wildcard in the middle of a word to get records where they are unsure of the spelling etc.
For instance, a search of 'Ste*en' should return results like 'Steven' and 'Stephen' etc. So if they are searching for word 'establishment' they can search for 'estab*ment' and it should return all the records using this query:
SELECT * FROM myTable WHERE CONTAINS(myField,'"estab*ment"')
If I do a wildcard at the end e.g: SELECT * FROM myTable WHERE CONTAINS(myField,'"estab*"')
I get the results I am looking for. But the middle wildcard does not seem to work as expected even though it is the syntax used on MSDN and other SQL info sites.
Is there something I am not doing properly?

View 4 Replies View Related

How To Insert With Wildcards

Aug 22, 2000

hello!

it's a little stupid but i can't seem to insert a certain data.
it's like this:

insert into dept(dept_no,dept_name)
values(4,"name's")

how do i insert with the (') included in the string?

View 1 Replies View Related

Wildcards In SQL Server

Nov 1, 1999

I have a stored procdure in SQL Sever that accepts paramteres. I am trying
to return rows where parameter that is passed is somewhere in the cuustomer's
name. Without the variable the SQL would look like this:

SELECT * FROM tbl
WHERE CustomerName LIKE '%Smith%'

I can't figure out how to replace LIKE '%Smith%' with a varible. I tried
'%@CustomerName%', ('%' + @CustomerName + '%') and neither works. Any ideas?
Thanks

ps my column's type is char(50) and so is the variable so trailing spaces
don't matter.

View 1 Replies View Related

Problems With Wildcards

Sep 7, 2007

Hi all,I am creating an ASP.NET site, and I'm having lots of issues trying to get wildcards to work with the following query:DECLARE @Status varcharDECLARE @AssignedTo intDECLARE @AppID intSELECT dbo.Issue.IssueID, dbo.Issue.ReportedBy, dbo.Issue.ShortDescription, dbo.Issue.DateReported, dbo.Issue.Status, dbo.Priority.Description AS Priority, dbo.Application.ApplicationFROM dbo.Issue INNER JOIN dbo.Priority ON dbo.Issue.Priority = dbo.Priority.PriorityCode INNER JOIN dbo.Application ON dbo.Issue.Application = dbo.Application.ApplicationIDWHERE (dbo.Issue.Status LIKE '%' + @Status) AND (dbo.Issue.AssignedTo = @AssignedTo) AND (dbo.Application.ApplicationID LIKE '%' + @AppID)ORDER BY dbo.Priority.PriorityCode When running this through query analyser I get the error:Server: Msg 245, Level 16, State 1, Line 5Syntax error converting the varchar value '%' to a column of data type int. Could someone help me understand this please?Thanks

View 5 Replies View Related

Wildcards And Numbers

Apr 18, 2007

How do Iput wildcards around a number in an sp ? If my user leaves BoxNo blank it will list all boxes


SELECT *
FROM tblFiles
WHERE
ConNo =@strRMUConsignmentNo
and FileRef like '%'+@strtxtFileRef+'%'
and Subject like '%'+@strtxtSubject+'%'
and FileDescription like '%'+@strtxtDescription+'%'
and BoxNo like %+@strBoxNo%

View 14 Replies View Related

Wildcards On Columns?

Nov 29, 2005

My use of wildcards thus far has been limited to matching a givenstring anywhere in a column as follows:SELECT * FROM Table WHERE Column LIKE '%string%'However, I'm wondering if there's a way to do this in reverse. Thatis, is there a way to match the column anywhere in the string?Pseudo-coding it as:SELECT * FROM Table WHERE 'string' LIKE %Column%What I'm trying to match is network addresses. Most of the storedaddresses in this table are exact (i.e. ip-1-2-3-4.location.isp.com)but sometimes they encompass an entire group (i.e. location.isp.com).When an exact address is given in the code I'm writing, it needs tomatch any rows that contain its exact self or contain a shortenedversion of which it is part.Any ideas?-cyber0nehttp://www.cyber0ne.com

View 3 Replies View Related

Findstring And Wildcards

Nov 29, 2007

Can you use wildcards with findstring? The documentation does not address this.

So far I haven't had any luck.

View 3 Replies View Related

Difference Between Index Seek &&amp; Index Scan &&amp; Index Lookup Operations?

Oct 20, 2006

please explain the differences btween this logical & phisicall operations that we can see therir graphical icons in execution plan tab in Management Studio

thank you in advance

View 3 Replies View Related

Master - Details In Reverse

Mar 20, 2006

HI, I'm using Visual Web Developer and SQL Server 2005 Express Editions. I have a database with two tables, say AccountsTable and PersonsTable, with a one to many relationship respectively.
Given a particular selected record in PersonsTable, I need to look up the corresponding master record in AccountsTable. Here's what I've done:
SqlDataSource1 has a "SELECT * FROM PersonsTable" and a GridView1 which uses this as its datasource and the 'enable Selection' checkbox is On. This works fine.
Then, I create a second SqlDataSource2. When I click on the WHERE button in the Configure Data Source page, I have chosen the following parameters:
Column:PrimaryKeyField; Operator:=; Source=Control; ControlID=GridView1; Default Value='I left this blank' but the Value field shows GridView1.SelectedValue when I click the ADD button.
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:bizConnectionString %>"
SelectCommand="SELECT * FROM [AccountsTable] WHERE ([AccountNumber] = @AccountNumber)">
<SelectParameters>
<asp:ControlParameter ControlID="GridView1" Name="AccountNumber" PropertyName="SelectedValue"
Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>

I have bound DetailsView1 to SqlDataSource2. When I run the page, the GridView1 is shown with Persons records OK. Then I click the 'Select' next to a record in the Gridview expecting the corresponding lookup to the master record (Account) to be shown in the DetailsView, but it does not show anything.
What am I doing wrong? Is there a better way of doing this?
Your help is much appreciated. Thank you.
PS. I could find Tutorials showing Master/Details retrieving records in a top down fashion (1:n), but I could not find the reverse (n:1)
 

View 6 Replies View Related

Can You Reverse A MSDE Install Over SQL 6.5?

May 23, 2000

I have a friend who has installed MSDE over SQL Server 6.5 - by doing so he broke some other apps that required a SQL 6.5 DB, he realises now it was a mistake on his part and would like to revert to SQL 6.5 again and recover his data, is this possible or has he lost all his old data?

BTW Backups weren't completed....

If anyone can help please let me know.

View 1 Replies View Related

Reverse Engineering And Output

Nov 18, 1999

Two Question

1. Is there a stored procedure, or a way to reverse engineer a database? I have a lot of legacy dbs that I have inherited that I need to create a recovery system for. Part of this is creating the scripts to build all of the tables and I would like to automate it.

2. How can I output the results of a stored procedure to a text file? When I run sp_configure I would like that information to go to a text file.

Thanks in advance
Ken Earley

View 3 Replies View Related

DDL Cube Reverse Generate

Aug 9, 2005

Hi guys

I have built several cubes. However I would need to create local cubes from the built cubes in Analysis Services. As a result I need to work out the DDL for my existing cubes. However the cube contains many mdx calculated members. I was wondering if it would be easier to simply generate the DDL from my existing cube in Analysis Services.

Does anyone know any third party tools that I can use to reverse engineer the DDL from the built cubes in Analysis Services ?

Thanks
Tom

View 2 Replies View Related

Reverse-engineer Database

Aug 31, 1998

I`d like to find a script that will create a "create" script for an entire database. It would write a create-table script for every table in the database, complete with all the PKs and FKs too.

Since I`m asking for the world (or at least the world`s creation script), then I`d also like the script to (optionally) write insert statements for all the rows currently residing in all the tables.

Do you have such a script? If not, can you give me a couple of pointers to assist me in writing my own?

TIA

View 3 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

Reverse Engineer Script

Aug 3, 2001

does anybody know of a script which can reverse engineer a database to a flat file - aprt from the one which is in enterprise maanger. I want to schedule a job to run once a week to compare the DDL of the database to make sure there are no changes ?

many thnanks

View 1 Replies View Related

[Fwd: Reverse Pattern Matching]

Jul 23, 2005

View 2 Replies View Related

Reverse Merge Repliction

Mar 1, 2007

hi

I have notice that i missed few columns in my merge repliction and i wonder is it possiblie to reverse a replicated database or copy to normal SQL database?

after that i would do a new Publication.

I need to have the data that is in the Database.

View 1 Replies View Related

Reverse Sign For Display

Aug 13, 2007

In Crystal Reports, there was a "reverse sign for display" property that could be checked for a number box. This was used for debits and credits (and such) so a negative number would be displayed as a positive and a positive displayed as a negative.

How would this work, or is there something simple, in Reporting Services?

Thanks for the information.

View 5 Replies View Related

Inner Join On Reverse Records

Jun 8, 2006

I have some data that looks like this

Col1 Col2 SumCol

XXX,YYY, 5

XXX,ZZZ,6

ZZZ,XXX,7

YYY,XXX,2

I want to do a inner join on that data so I get this

XXX,YYY, 7

XXX,ZZZ,13

Right now I'm using a CTE set to do that, is there a better way??

View 6 Replies View Related







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