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 '
        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.

It depends on database you are using. When you use an Oracle database you should use || (double pipe) to concat, + can be used with SQL Server and for MySQL you should use Concat('A', 'B')....

im using sql server 2005. It is not supported CONCAT command....

@Pritaes: You've got a point and is more described in: Click Here, especially Click Here
Thank you for this opportunity to learn....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.