Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 dynamic query search

Author  Topic 

ajay
Starting Member

34 Posts

Posted - 2001-05-17 : 05:03:05
Hello Sql,
I want to perform a search into SQL database depending upon the location of the user on the site.
Meaning If the user is in the finance section, my searching table name will be different and if he is in the Lifestyle section the table name would be different.
Also I have created a full text catalouge for all these table, so I also have to use CONTAINS FUNCTION, Moreever the no of fields which I select from these table would differ.

Can it be done in one stored procedure where I pass the no of records to be displayed,the current page number and the search text also the location of the user.

If we talk about creating a temp table inside the stored procedure and first fetch no of records into it and then takin them out, In that case what would be my temp table design as I have different no of fields to be fetched for different section.

I dunno if it works like this:

create proc sp_fetchRecords
(
@location_user varchar(30),
@pagenumber int,
@no_rec_display int,
@search_text varchar(50)
)

if @location='x'
sql is differenr like select a,b,c from u where.......and contains(*, and so on)
else if @location='y'
sql is different like select x,y from v where....and contains(*,"var1" or "var2")

if this can be done, In that case what would be the design of my temp table inside the stored proc.



Thanks for the help


ajay
   

- Advertisement -