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)
 search two fields by one string

Author  Topic 

akpaga
Constraint Violating Yak Guru

331 Posts

Posted - 2008-12-03 : 13:27:27
i have a two fields in a table -firstname and last name.
When user searches by firstname,lastname

then the two fields should show up as one in the result.

search term : arun,jogi
result: arun jogi

how can i do this

Thanks in advance


visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-12-03 : 13:30:48
[code]select firstname+ ' '+lastname
from table
where firstname+ ','+lastname = @searchterm[/code]
Go to Top of Page

akpaga
Constraint Violating Yak Guru

331 Posts

Posted - 2008-12-03 : 15:27:25
Hi Visakh 16


actually
i have the query written as follows

select * from (select customer_nbr,firstname+ ' '+lastname as customer_name
from customer
unioin all
select customer_nbr,null from articles ) as x
where x.customer_name= @searchterm

so in this place i having trouble.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-12-03 : 15:37:16
You have a comma in your search string but you do not include comma in your query...



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page
   

- Advertisement -