Sp di Sistema

venerdì 07 agosto 2009 - 15.32

delama77 Profilo | Junior Member

Ciao a tutti ,
quando la sp di sistema sp_databases non mi restituisce nessun valore c'è un modo per rimediare ?

Ho la necessità di recuperare in un windows control in vb net selezionando da una lista una particolare istanza voglio popolare una ulteriore lista in cui vado a individuare tutti i db disponibili .

In alcuni casi mi restituisce la lista dei db in altri mi restituisce il vuoto pur avendo delle basi dati collegate .

C'è un modo per popolare la tabella da cui ricavi i nome dei DB???

Grazie in anticipo a tutti

Alessandra

lbenaglia Profilo | Guru

>quando la sp di sistema sp_databases non mi restituisce nessun
>valore c'è un modo per rimediare ?
Dai BOL: "Requires CREATE DATABASE, or ALTER ANY DATABASE, or VIEW ANY DEFINITION permission, and must have access permission to the database".
Se ti mancano queste permission, non verrà restituito l'elenco dei db, oppure sarà parziale.

In alternativa puoi interrogare la catalog view sys.databases, ma occhio che "If the caller of sys.databases is not the owner of the database and the database is not master or tempdb, the minimum permissions required to see the corresponding row are ALTER ANY DATABASE or VIEW ANY DATABASE server-level permission, or CREATE DATABASE permission in the master database. The database to which the caller is connected can always be viewed in sys.databases".

>Grazie in anticipo a tutti
Prego.

Ciao!
--
Lorenzo Benaglia
Microsoft MVP - SQL Server
http://blogs.dotnethell.it/lorenzo/
http://italy.mvps.org

delama77 Profilo | Junior Member

>>quando la sp di sistema sp_databases non mi restituisce nessun
>>valore c'è un modo per rimediare ?
>Dai BOL: "Requires CREATE DATABASE, or ALTER ANY DATABASE, or
>VIEW ANY DEFINITION permission, and must have access permission
>to the database".
>Se ti mancano queste permission, non verrà restituito l'elenco
>dei db, oppure sarà parziale.
>
>In alternativa puoi interrogare la catalog view sys.databases,
>ma occhio che "If the caller of sys.databases is not the owner
>of the database and the database is not master or tempdb, the
>minimum permissions required to see the corresponding row are
>ALTER ANY DATABASE or VIEW ANY DATABASE server-level permission,
>or CREATE DATABASE permission in the master database. The database
>to which the caller is connected can always be viewed in sys.databases".
>
>>Grazie in anticipo a tutti
>Prego.
>

Ho risolto riesco con la sys.databases...
Ho scritto prima ancora di provare a cercare bene ....

Grazie

Alessandra
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?

Dopo esserti registrato potrai chiedere
aiuto sul nostro Forum oppure aiutare gli altri

Consulta le Stanze disponibili.

Registrati ora !
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5