Click here to Skip to main content
16,012,223 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi i want to create stored procedure for example..
BID         TID
10.3.4   test1
10.3.4   test2
10.3.5   test1

now i want to search create stored procedure like when i search in page for TID think m searching test1 ok and i want tat records only for perticular BID s TID.

can anyone help??
Posted
Comments
ythisbug 20-Feb-12 0:35am    
is this possible to search like my requirements??
Johannes Hillert 20-Feb-12 1:41am    
I don't get your question.

Do you want to create a stored procedure that takes TID as parameter and returns the first column where it finds TID and omit any other columns where TID can be found?

Can you please clarify your question?
ythisbug 20-Feb-12 2:23am    
ya dude

SQL
CREATE PROCEDURE FindTIDByBID 
 (
  @BID NVARCHAR(50)
 )
 AS
 Begin
   SELECT TID FROM table WHERE BID=@BID    
 End
 
Share this answer
 
Comments
André Kraak 21-Feb-12 1:38am    
Edited question:
Added pre tags
"Treat my content as plain text..." option disabled.
SQL
CREATE PROCEDURE FindBIDByTID 
 (
  @TID NVARCHAR(50)
 )
 AS
 Begin
   SELECT BID FROM table1 WHERE TID=@TID    
 End


Hope this helps if yes then accept and vote the answer
--Rahul D.
 
Share this answer
 
v2
If TID is a text column then there will be little change in store procedure

SQL
CREATE PROC SP_getTId
@TID nvarchar(1000)
AS
select BID from table1 where TID like @TID
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900