programming:sql:mssql
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| programming:sql:mssql [2026/01/27 09:56] – Added the subheadline "Show database owner" with TSQL and source links. bas | programming:sql:mssql [2026/01/27 10:00] (current) – Added exeample to limit database to those of a specific user to [Show database owner]. bas | ||
|---|---|---|---|
| Line 329: | Line 329: | ||
| SELECT name, owner_sid, (SELECT SUSER_SNAME(owner_sid)) AS owner_name FROM sys.databases | SELECT name, owner_sid, (SELECT SUSER_SNAME(owner_sid)) AS owner_name FROM sys.databases | ||
| WHERE name LIKE ' | WHERE name LIKE ' | ||
| + | ORDER BY name | ||
| + | </ | ||
| + | |||
| + | Show only databases whose name starts with " | ||
| + | |||
| + | <code tsql> | ||
| + | SELECT name, owner_sid, (SELECT SUSER_SNAME(owner_sid)) AS owner_name FROM sys.databases | ||
| + | WHERE name LIKE ' | ||
| + | AND (SELECT SUSER_SNAME(owner_sid)) = ' | ||
| ORDER BY name | ORDER BY name | ||
| </ | </ | ||
programming/sql/mssql.txt · Last modified: by bas
