I am having following issue.Even after case insensitive collation. SQL server is treating @Result
and @result
differently. Am i missing something.Please help.
SELECT DATABASEPROPERTYEX('OA_OPTGB_0423', 'Collation') SQLCollation;
SQL_Latin1_General_CP1_CI_AS
DECLARE @Result varchar(2000)
SELECT TOP 1 @result = addr.address_id
FROM dbo.address addr
JOIN dbo.company_address compadd ON addr.address_id = compadd.address_id
ORDER BY addr.address_id desc
...throws this error:
Msg 137, Level 15, State 1, Line 2
Must declare the scalar variable "@result".
Edit:-
This same query works in my local machine.I tried it and got no error.