I faced to a huge problem when i coding some stored procedure. How to combine some string to sql string in stored procedure???
This is what i did upto now.
@WhereCondition = ' WHERE id = 102 '
DECLARE recoredSet CURSOR FOR
SELECT SUM(Amount) as AmountSum FROM sale + @WhereCondition
OPEN recoredSet
--After above code I wrote fetch commands and it has no any problem.
In above code, @WhereCondition is assinged some value.
Eg: @WhereCondition = ' WHERE id = 5 '
But the problem is plus mark (+) is not supported. If Plus mark is not there, the code is working well.
My Problem is how to combined some string to a sql string like above code. I put and sign (&) instead of plus mark. But it doesnt work.