Q:

compare 2 parameters with 1 coloumn while passing parameters in SQL Server 2008

i have to pass two parameters (month var-char(2),year var char(4)),but these two parameters pointing towards one coloumn 'Myear'(values will be like this '03/14') now after passing parameters then i should compare with the coloumn 'Myear' then have to get data.kindly please any one help me out..thanks in advance

A:

If Myear is varchar, then try this:
SELECT Myear
FROM TableName
WHERE SUBSTRING(Myear,1,2)=@month
    AND SUBSTRING(Myear,4,2)=SUBSTRING(@year,3,2)

Suppose @Myear=03/14 and given parameters are @month=05 and @year=2013, then it will check 
if 03=05 AND 14=13.
The syntax of SUBSTRING():
SUBSTRING ( expression ,start , length )

