Problem with multiple access to query

I am developing an asp .net application that has a search engine. Many users connect to the DB as one user. My problem is when the user executes a search I have created a query that looks like this(in my example they enter the key words )

Select distinct * into t0 from dc_image where DC_Barcode Like '%E06%'
OR Eng_Barcode Like '%E06%' OR DC_ProjectCode Like '%E06%' OR DC_Number Like '%E06%' OR DC_Sheet Like '%E06%' OR DC_Revision Like '%E06%' OR DC_Title Like '%E06%' OR DC_Alt_Number Like '%E06%' OR DC_Rev_Decs Like '%E06%' OR DC_Date Like '%E06%' OR DC_Time Like '%E06%' OR DC_Status Like '%E06%' OR DC_FileType Like '%E06%'

Select * into t1 from t0 where DC_Barcode Like '%NA%' OR Eng_Barcode Like '%NA%'
OR DC_ProjectCode Like '%NA%' OR DC_Number Like '%NA%' OR DC_Sheet Like '%NA%'
OR DC_Revision Like '%NA%' OR DC_Title Like '%NA%' OR DC_Alt_Number Like '%NA%'
OR DC_Rev_Decs Like '%NA%' OR DC_Date Like '%NA%' OR DC_Time Like '%NA%'
OR DC_Status Like '%NA%' OR DC_FileType Like '%NA%'

Select * from t1

drop t1
drop t0

So my problem is that multiple users can search at the same time, so if user A searches, then user B searches the tables will already be created. There has to be a simple way around this. I was thinking of just timestamping the search.

Or perhaps I am doing my search part too resource unfriendly. I would like to be able to grab a data from a table T, where each row must contains the key words entered by the user. So a table that looks like:

1:x|y|z
- - -
2:z|t|f
- - -
3:x|x|f
- - -
4:x|z|f
- - -
5:x|z|t

if we entered the key words z, t
i would want row 2,5 to return.

Thanks for your help.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories