Thursday, March 29, 2012

determine system database...

what is the best way to determine if a database is actually a system
database through tsql?
The only tangible thing that I can see is dbid. however I would far rather a
database property to check in t-sql.
Thanks in advance,
M.Here is some idea.
Check how Microsoft guys are doing that. Build a simple application that
uses Microsoft.SqlServer.Management.Smo.Database.IsSystemObject property
for each database. Run Profiler and see how SMO is checking if the database
is a system database or not.
--
Regards
Pawel Potasinski
[http://www.potasinski.pl]
U¿ytkownik "Mark B" <nospam@.nospam.com> napisa³ w wiadomo¶ci
news:eEvpWO%23OIHA.4808@.TK2MSFTNGP05.phx.gbl...
> what is the best way to determine if a database is actually a system
> database through tsql?
> The only tangible thing that I can see is dbid. however I would far rather
> a database property to check in t-sql.
> Thanks in advance,
> M.
>|||cannot get it to work.
smo throws exception when I create the database object.
"Pawel Potasinski" <pawel.potasinski@.gmail.com> wrote in message
news:%23pkyNj%23OIHA.3816@.TK2MSFTNGP04.phx.gbl...
> Here is some idea.
> Check how Microsoft guys are doing that. Build a simple application that
> uses Microsoft.SqlServer.Management.Smo.Database.IsSystemObject property
> for each database. Run Profiler and see how SMO is checking if the
> database is a system database or not.
> --
> Regards
> Pawel Potasinski
> [http://www.potasinski.pl]
>
> U¿ytkownik "Mark B" <nospam@.nospam.com> napisa³ w wiadomo¶ci
> news:eEvpWO%23OIHA.4808@.TK2MSFTNGP05.phx.gbl...
>> what is the best way to determine if a database is actually a system
>> database through tsql?
>> The only tangible thing that I can see is dbid. however I would far
>> rather a database property to check in t-sql.
>> Thanks in advance,
>> M.
>|||To the best of my knowledge, there is no such property available anywhere. I believe that even SMO
and DMO goes by the database name.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Mark B" <nospam@.nospam.com> wrote in message news:eEvpWO%23OIHA.4808@.TK2MSFTNGP05.phx.gbl...
> what is the best way to determine if a database is actually a system database through tsql?
> The only tangible thing that I can see is dbid. however I would far rather a database property to
> check in t-sql.
> Thanks in advance,
> M.
>|||Exactly Tibor. More precisely - by they go by name for master, msdb, tempdb
and model but there's more. Distribution database for replication can have a
custom name and is also considered to be a system database so they also
check for the value of is_distributor column in sys.databases for each
database.
--
Regards
Pawel Potasinski
[http://www.potasinski.pl]
Uzytkownik "Tibor Karaszi"
<tibor_please.no.email_karaszi@.hotmail.nomail.com> napisal w wiadomosci
news:5900A85D-F0B1-4BAE-9FA4-BC2E37AB28CE@.microsoft.com...
> To the best of my knowledge, there is no such property available anywhere.
> I believe that even SMO and DMO goes by the database name.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "Mark B" <nospam@.nospam.com> wrote in message
> news:eEvpWO%23OIHA.4808@.TK2MSFTNGP05.phx.gbl...
>> what is the best way to determine if a database is actually a system
>> database through tsql?
>> The only tangible thing that I can see is dbid. however I would far
>> rather a database property to check in t-sql.
>> Thanks in advance,
>> M.
>|||> so they also check for the value of is_distributor column in sys.databases for each database.
Ahh, that's good to know. Thanks Pawel.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Pawel Potasinski" <pawel.potasinski@.gmail.com> wrote in message
news:%23oXeDGQPIHA.4272@.TK2MSFTNGP06.phx.gbl...
> Exactly Tibor. More precisely - by they go by name for master, msdb, tempdb and model but there's
> more. Distribution database for replication can have a custom name and is also considered to be a
> system database so they also check for the value of is_distributor column in sys.databases for
> each database.
> --
> Regards
> Pawel Potasinski
> [http://www.potasinski.pl]
>
> Uzytkownik "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> napisal w wiadomosci
> news:5900A85D-F0B1-4BAE-9FA4-BC2E37AB28CE@.microsoft.com...
>> To the best of my knowledge, there is no such property available anywhere. I believe that even
>> SMO and DMO goes by the database name.
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://sqlblog.com/blogs/tibor_karaszi
>>
>> "Mark B" <nospam@.nospam.com> wrote in message news:eEvpWO%23OIHA.4808@.TK2MSFTNGP05.phx.gbl...
>> what is the best way to determine if a database is actually a system database through tsql?
>> The only tangible thing that I can see is dbid. however I would far rather a database property
>> to check in t-sql.
>> Thanks in advance,
>> M.
>>
>|||cannot get smo property to work!
"Pawel Potasinski" <pawel.potasinski@.gmail.com> wrote in message
news:%23pkyNj%23OIHA.3816@.TK2MSFTNGP04.phx.gbl...
> Here is some idea.
> Check how Microsoft guys are doing that. Build a simple application that
> uses Microsoft.SqlServer.Management.Smo.Database.IsSystemObject property
> for each database. Run Profiler and see how SMO is checking if the
> database is a system database or not.
> --
> Regards
> Pawel Potasinski
> [http://www.potasinski.pl]
>
> U¿ytkownik "Mark B" <nospam@.nospam.com> napisa³ w wiadomo¶ci
> news:eEvpWO%23OIHA.4808@.TK2MSFTNGP05.phx.gbl...
>> what is the best way to determine if a database is actually a system
>> database through tsql?
>> The only tangible thing that I can see is dbid. however I would far
>> rather a database property to check in t-sql.
>> Thanks in advance,
>> M.
>

No comments:

Post a Comment