Skip to Content
0
Former Member
Sep 04, 2014 at 12:56 PM

Bug with Sybase dynamic SQL resolution

207 Views

We have some dynamic SQL in a stored procedure which selects data from a table in another database in server

eg

create proc x

as

...

select @sql = "select " + @col + " from " + @db_and_view + " where ..."

...

However this fails with the message

The request for view 'DB.dbo.view_name' failed because

'DB.dbo.view_name' is a procedure object.

Upon investigation, it seems the dynamic SQL is failing because a procedure in the current database has the same object id

as the proc in the other database.

DB1

id type name

1545053509 P proc

DB2

id type name

1545053509 V view

We're using Sybase 15.7 SP100.

I assume this is a bug. Anyone know how we can get around this without re-writing tons of stored procedures.