MSSQL Server - SELECT failed because the following SET options have incorrect setting

Hello Guys,

Just wanted to ask how I can resolve this issue.

This is the stored procedure:

set ANSI_NULLS on
Go
set ANSI_WARNINGS on
Go
set ANSI_PADDING on
Go
set CONCAT_NULL_YIELDS_NULL on
Go
set QUOTED_IDENTIFIER on
Go
set ARITHABORT on
GO
ALTER PROCEDURE [dbo].[sha1key_lookup]
@sha1key varchar(max)
AS
declare @varbin varbinary(max);
set @varbin =
(select cast(‘’ as xml).value(‘xs:hexBinary( substring(sql:variable(“@sha1key”), sql:column(“t.pos”)) )’, ‘varbinary(max)’)
from (select case substring(@sha1key, 1, 2) when ‘0x’ then 3 else 0 end) as t(pos))
SET NOCOUNT ON;
SELECT top 1 *
FROM dbo.iradata
WHERE sha1key = @varbin;

THEN I’m calling this Stored procedure via PHP using this command

$result = mssql_query(“exec dbo.sha1key_lookup @sha1key = N’FCF8AC1627D6B1C938AFE00FDC34B7FE86189DFB’”, $dbhandle);

RESULT IN THE BROWSER IS

Warning: mssql_query() [function.mssql-query]: message: SELECT failed because the following SET options have incorrect settings: ‘CONCAT_NULL_YIELDS_NULL, ANSI_WARNINGS, ANSI_PADDING’. Verify that SET options are correct for use with indexed views and/or indexes on computed columns and/or query notifications and/or xml data type methods. (severity 16)

Been banging my head regarding this for almost a week now. Google doesn’t really offer much help either.

Thanks