Symptom
How to query system tables for the existence of a user in each database in ASE?
Below query results in a Msg 10351, Level 14, State 1 error.
SET NOCOUNT ON
GO
DECLARE IdxCursor cursor for select name from master..sysdatabases where status & 1024 <> 1024 and lower(name) <> 'tempdb'
and name not in (select name from master..sysdatabases where status2 & 1024 = 1024)
and name not in (select name from master..sysdatabases where status2 & 16 = 16)
GO
DECLARE @dbname varchar(255)
DECLARE @sqlselect varchar(255)
OPEN IdxCursor
FETCH IdxCursor into @dbname
WHILE (@@sqlstatus = 0)
BEGIN
USE @dbname
SELECT @sqlselect = 'select @dbname as DB_Name,count(*) as counts from sysindexes i where (i.status & -32768) != 0'
EXEC (@sqlselect)
FETCH IdxCursor into @dbname
END
DEALLOCATE cursor IdxCursor
GO
Msg 10351, Level 14, State 1:
Server 'SERVER_NAME', Line 11:
Server user id 7 is not a valid user in database 'sampledb'.
Read more...
Environment
SAP Adaptive Server Enterprise (ASE) 16.0
Product
Keywords
Msg 10351, 10351, monitoring query, @sqlselect, execute as owner, query, system tables , KBA , BC-SYB-ASE , Sybase ASE Database Platform (non Business Suite) , Problem
About this page
This is a preview of a SAP Knowledge Base Article. Click more to access the full version on SAP for Me (Login required).Search for additional results
Visit SAP Support Portal's SAP Notes and KBA Search.