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
 Transact-SQL (2000)
 Procedure help required

Author  Topic 

vikram1
Starting Member

13 Posts

Posted - 2006-05-06 : 13:38:11
If anyone could me help me in this then it would be gr8 ...well i need to pass three variables and the second variable should be contained in the first one i.e if you have first variable value as "HATID" and the second variable as " HA" the result should be in the third variable as "YES" otherwise "NO"

Pls somebody suggest me a procedure for this

Srinika
Master Smack Fu Yak Hacker

1378 Posts

Posted - 2006-05-06 : 13:42:43
Learn
how to write a simple function
how to pass a parameter
how to call a function
how to return a value

Then find about string functions as substring.

try and come back, explaining where u end up.


Srinika
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2006-05-06 : 14:05:25
Does this help you?

declare @v1 varchar(10)
,@v2 varchar(10)
,@v3 varchar(3)

select @v1 = 'HATID'
,@v2 = 'HA'

select @v3 = case
when patindex('%' + @v2 + '%', @v1) > 0
then 'YES'
else 'NO'
end

select @v3 [@v3YesOrNo]

-----------------------------------------------------------------
output:

@v3YesOrNo
----------
YES


Be One with the Optimizer
TG
Go to Top of Page

god_lucifer
Starting Member

3 Posts

Posted - 2006-05-07 : 13:04:48
hey srinika this forum is supposedly to help i guess??
Go to Top of Page

Srinika
Master Smack Fu Yak Hacker

1378 Posts

Posted - 2006-05-09 : 15:22:22
quote:
Originally posted by god_lucifer

hey srinika this forum is supposedly to help i guess??



Yes, ur guess is correct, and for the beginers to learn as well.

The amount of help depends upon the individual.
If the person wants to get more help he can be more specific.
I don't think anybody here is willing to help for the questions like,
-- how to write a function in SQL server.
-- What is a SQL query

Insted of answering basic question like that, I have seen most ppl use to give web sites to learn basic SQL.

Its much effective if somebody learns by experimenting.
Its much easier if some attempts were made before asking a question.

The steps I gave, guids the Question raiser, to reach his goal step by step.

Thanks for ur concerns


Srinika
Go to Top of Page
   

- Advertisement -