Click here to Skip to main content
15,888,610 members
Home / Discussions / Database
   

Database

 
GeneralRelation between tables Pin
RoyRose7829-Jul-04 20:17
RoyRose7829-Jul-04 20:17 
GeneralRelation between tables Pin
Sendilkumar.M30-Jul-04 19:13
Sendilkumar.M30-Jul-04 19:13 
GeneralRe: Relation between tables Pin
RoyRose7830-Jul-04 22:15
RoyRose7830-Jul-04 22:15 
GeneralPlease recommend on connection to Ms Acess Database Pin
DotNet29-Jul-04 15:16
DotNet29-Jul-04 15:16 
GeneralRe: Please recommend on connection to Ms Acess Database Pin
EdbertP29-Jul-04 16:52
EdbertP29-Jul-04 16:52 
GeneralUser access to SQL Server database Pin
Colin Angus Mackay29-Jul-04 6:35
Colin Angus Mackay29-Jul-04 6:35 
GeneralRe: User access to SQL Server database Pin
Grimolfr29-Jul-04 7:56
Grimolfr29-Jul-04 7:56 
GeneralRe: User access to SQL Server database Pin
Colin Angus Mackay29-Jul-04 22:37
Colin Angus Mackay29-Jul-04 22:37 
That doesn't work. Actually I find that the INFORMATION_SCHEMA is quite eccentric in what it returns (see end note).

When I run the statement you gave, SELECT CATALOG_NAME FROM INFORMATION_SCHEMA.SCHEMATA, I get a list of all the databases. This is not useful as it still list the database that I cannot access.

If I SELECT * FROM INFORMATION_SCHEMA.SCHEMATA it tells me that the schema owner is the same as the user logged in for a database that that user cannot access.

If I then issue a USE [p1_p2_destination_database] command I get the following:
916: Server user 'fails_2' is not a valid user in database 'p1_p2_destination_database'.

'fails_2' is the user that is not supposed to be able to access that particular database (These are part of the tests I am running to ensure the stored procedure that I am writing behaves correctly for a given situation). All 'fails_2' has in the server is access in the 'master' and 'p1_p2_source_database', it also owns a table in 'p1_p2_source_database'. It is correct that it issues an error if I try to USE the 'p1_p2_destination_database' but I want to trap that situation before it arises.

I don't know if this helps explain the situation more clearly.



As an aside the code for INFORMATION_SCHEMATA is:
--Identifies schmata owned by current users, databases current users has permissions in
create view INFORMATION_SCHEMA.SCHEMATA
 as
select
	db.name						as CATALOG_NAME
	,USER_NAME()				as SCHEMA_NAME
	,USER_NAME()				as SCHEMA_OWNER
	,convert(sysname, NULL)		as DEFAULT_CHARACTER_SET_CATALOG
	,convert(sysname, NULL)		as DEFAULT_CHARACTER_SET_SCHEMA
	,a_cha.name					as DEFAULT_CHARACTER_SET_NAME
FROM
	master.dbo.sysdatabases 		db,
	master.dbo.syscharsets		a_cha --charset/1001, not sortorder.
WHERE
	a_cha.type = 1001 --- type is charset
	AND a_cha.id = convert(tinyint, DatabasePropertyEx(db.name, 'sqlcharset'))


I don't see anywhere in this where filters anything by permission. If anything just returneing USER_NAME() for the SCHEMA_NAME and SCHEMA_OWNER is just pointless.


"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell

Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!


QuestionODBC API's code examples? Pin
PrashantJ28-Jul-04 21:54
PrashantJ28-Jul-04 21:54 
Generalxml to excel Help! Pin
michanne128-Jul-04 12:07
michanne128-Jul-04 12:07 
GeneralCreate System Database form C# using ADOX Pin
ulrich_v28-Jul-04 0:37
ulrich_v28-Jul-04 0:37 
GeneralNeed help!!! Pin
yanh10027-Jul-04 14:12
yanh10027-Jul-04 14:12 
QuestionCan I call OLEDB and ADO from the same app? Pin
CherezZaboro27-Jul-04 8:34
CherezZaboro27-Jul-04 8:34 
GeneralADO Connection Failure...HELP!!!!! Pin
girl_lash26-Jul-04 21:27
girl_lash26-Jul-04 21:27 
GeneralRe: ADO Connection Failure...HELP!!!!! Pin
Bill Dean27-Jul-04 4:45
Bill Dean27-Jul-04 4:45 
GeneralRe: ADO Connection Failure...HELP!!!!! Pin
girl_lash27-Jul-04 14:22
girl_lash27-Jul-04 14:22 
GeneralRe: ADO Connection Failure...HELP!!!!! Pin
Bill Dean28-Jul-04 9:49
Bill Dean28-Jul-04 9:49 
GeneralUsing MDB database with OLEDB/ATL/MFC (from SQL Server) Pin
Gian26-Jul-04 2:15
Gian26-Jul-04 2:15 
GeneralWindows-only authentication not working Pin
sid98dha26-Jul-04 0:40
susssid98dha26-Jul-04 0:40 
GeneralRe: Windows-only authentication not working Pin
Mike Dimmick26-Jul-04 5:29
Mike Dimmick26-Jul-04 5:29 
GeneralCurious about a query Pin
brdavid25-Jul-04 15:12
brdavid25-Jul-04 15:12 
GeneralRe: Curious about a query Pin
Grimolfr26-Jul-04 4:26
Grimolfr26-Jul-04 4:26 
GeneralRe: Curious about a query Pin
brdavid26-Jul-04 6:04
brdavid26-Jul-04 6:04 
GeneralRe: Curious about a query Pin
Michael Potter26-Jul-04 10:36
Michael Potter26-Jul-04 10:36 
GeneralRe: Curious about a query Pin
Grimolfr26-Jul-04 11:28
Grimolfr26-Jul-04 11:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.