score:3
Accepted answer
Is there a reason it needs to be more advanced than just this?
SELECT * FROM sysdatabases WHERE name NOT IN('master', 'tempdb', 'model', 'msdb')
Read More
- How to display user databases only in sqlserver?
- SQL Server Profiler - How to filter trace to only display events from one database?
- In SQL Azure how can I create a read only user
- How to give a user only select permission on a database
- How can I get a list of all of the user databases via t-sql?
- How to display values only upto 2 decimal places
score:0
Or per this thread:
select * from sys.sysdatabases where dbid>4 and [name] not like '$'
score:1
You should specify them with their owner name
. In order to do that, you should join sys.databases
with sys.server_principals
.
Recent versions can have ReportServer databases as well with contains $
sign in name.
select
d.name
,d.database_id
from
sys.databases d
join
sys.server_principals p
on p.sid = d.owner_sid
where
p.name <> 'sa' and d.name not like '%$%';
More questions
- How do I create a user in SQL-Server that only has access to one table, and can only insert rows
- SQL Server Profiler - How to filter trace to only display TSQL containing a DELETE statement?
- How to find loginname, database username, or roles of sqlserver domain user who doesn't have their own login?
- How to restrict a user to access objects of only one schema in SQL Server 2008?
- C#, Sql Server 2008: Stream large result set to end user only works on some databases
- How can I remove a specific security user from all databases on a server matching a given name?
- How to display only Hijri Year in SQL Server?
- SQL Server 2008 R2 : how to disable the remote access only for the user "sa"?
- Pyodbc execute sqlserver stored procedure -- how to pass in DEFAULT parameter for User Defined Table
- How to restrict a data entry user to work only 8 hours on my website
- SQL: How can I display full 7 days of the week with my data that only represents some days of the week?
- Rank displaying for all user fine. But how do I display rank for one user?
- How to Display only the Datepart using Expression in SSRS?
- How to display an equal sign as the only thing in a tablix cell
- How can I get all user created databases in SQL server 2005?
- How to get only 1 user available in group - SQL
- How would I filter out this column to display only english characters? Microsoft SQL Server Management Studio
- How to display a message to the user about maintenance and nightly jobs in PHP + MS SQL application
- How to format mssql datetime column to display only time on web page input field?
- Display all options if user is admin and only one option if not admin in SQL query
- how to restrict user access: only connect and exec function
- How to return or display distinct values only from a specific column using EF Core?
- How to check existence of tables in different databases in a proc - SQLServer
- How to convert a date column in TSQL to display only the month and year
More questions with similar tag
- selecting rows the id's of which appear in a column of another table
- Circular dependency hell. Use value from previous row in current one
- Restrict SQL subquery in SELECT
- How do I import columns into Excel from SQL in the same order as they are in SQL Server?
- Incorrect syntax near 'achternaam'
- Control flow "skips" an execute SQL task
- Connect to remote server in T-SQL (SQL server 2008)
- What are SSIS packages deployment and change-tracking best practices?
- How do I write an SQL query which looks for a value in all columns and all tables in my database?
- Recursive SQL Query descending
- SQL Server : parameter not evaluating in AND part of clause
- Select and Data-Retrieval Operations Error
- Adding averages to a table
- Pivot multiple columns with a column value repeats for each new column
- auto running number id with format yyyx/year number (9999/12) in sql server stored procedure
- Automated file import with SSIS package
- Slow distinct query in SQL Server over large dataset
- INSERT INTO .. SELECT .. unique constraint violation
- IIS 8.5 SQL Error Locating Server 26 During Deployment
- Reading a text file using SQL in SQL server 2005
- SQL Server LocalDB simply failing to create DB
- Using same table in many database
- Should sql server schemas be used for logical or administrative grouping?
- sql query for difference between current row and previous row based on datetime
- get sql data based on logged in user
- Can't use ORDER BY when SELECTing from a view in a stored procedure
- How can I create valid connection string by using shared memory protocol to connect a named instance of sql server?
- SQL Server - Using Quoted Identifier ON and OFF and Getdate()
- Comparison of Linq to SQL and Stored procedures in terms of performance
- Suggestions for speeding up MSSQL JOINED query
Source:
stackoverflow.com