I'm going trying to fix an issue that is burning and I've spent the last day without success. I have a database server running SQL Server 2008, one database and one stored procedure.
The stored procedure logic contains the following sentence:
IF EXISTS
(
SELECT *
FROM dbo.sysobjects
WHERE id = OBJECT_ID( '<StoredProcedureNameHere>' )
AND OBJECTPROPERTY( id, N'IsProcedure' ) = 1
)
BEGIN
-- Do something here
END
Now, the issue:
If I run a query from the Management Studio script to execute the stored procedure under investigation it works correct and executes the "-- Do something here" logic. However, exactly the same stored procedure invoked from a web service does NOT work. I disabled for testing the entire IF EXISTS(---) block and retrieved information is the correct one.
My preliminary conclusion is there should be any permission setting ( I'm obviously not aware of ) configured for my user account over the database (and thus on sysobject table ) allowing me to successfully get the information that is NOT in place of the user account used by the web service to access the database.
Anybody knows any standard setting I should validate to have this working ?.
Hint - Both database and web service components were perfectly working. All this kind of issues started to come up right after the database server crashed and Operations teams needed to rebuild the database server. On asking about the state of the databases, they said they were able to backup the database and they must work as restored right after the new server was build.
Any assistance will be greatly appreciated.
Thanks,