When I am not blogging, I am typically working on SQL Server Optimization projects. Time and again, I only have access to SQL Server Management Studio that I can remotely connect to server but do not have access to Operating System, and it works just fine.
At one point in optimization project, I have to decide [...]
Posts Tagged ‘undocumented SQL’
SQL SERVER – Get a List of Fixed Hard Drive and Free Space on Server
Posted in SQL, SQL Authority, SQL Query, SQL Server, SQL Stored Procedure, SQL Tips and Tricks, T SQL, Technology, tagged undocumented SQL on August 5, 2009 | 10 Comments »
SQL SERVER – List All the Tables for All Databases Using System Tables
Posted in Pinal Dave, Readers Question, SQL, SQL Authority, SQL Query, SQL Scripts, SQL Server, SQL Stored Procedure, SQL System Table, SQL Tips and Tricks, SQLServer, T SQL, Technology, tagged undocumented SQL on April 26, 2009 | 7 Comments »
Today we will go over very simple script which will list all the tables for all the database.
sp_msforeachdb ’select ”?” AS db, * from [?].sys.tables’
Update: Based on comments received below I have updated this article. Thank you to all the readers. This is good example where something small like this have good participation from readers.
Reference : Pinal Dave (http://www.SQLAuthority.com)
SQL SERVER – Find Table in Every Database of SQL Server – Part 2
Posted in Pinal Dave, SQL, SQL Authority, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, T SQL, Technology, tagged undocumented SQL on May 5, 2008 | 7 Comments »
Long time blog reader and SQL Server Expert Simon Worth has suggested two additional method to achieve same results as described in article SQL SERVER – Find Table in Every Database of SQL Server.
Method 1
sp_msforeachdb “SELECT ‘?’ DatabaseName, Name FROM ?.sys.Tables WHERE Name LIKE ‘%address%’”
Method 2
CREATE TABLE #TableNameResults (DatabaseName VARCHAR(100) NOT NULL, TableName VARCHAR(100) NOT [...]
SQL SERVER – Stored Procedure to Know Database Access Permission to Current User
Posted in Pinal Dave, SQL, SQL Authority, SQL Cursor, SQL Query, SQL Scripts, SQL Server, SQL Stored Procedure, SQL Tips and Tricks, T SQL, Technology, tagged undocumented SQL on September 23, 2007 | 5 Comments »
Jr. DBA in my company only have access to the database which they need to use. Often they try to access database and if they do not have permission they face error. Jr. DBAs always check which database they have access using following system stored procedure. It is very reliable and provides accurate information.
Sytanx:
EXEC sp_MShasdbaccess
GO
ResultSet: [...]
SQL SERVER – DBCC commands List – documented and undocumented
Posted in SQL, SQL Authority, SQL Documentation, SQL Query, SQL Server, SQL Server DBCC, SQL Tips and Tricks, T SQL, Technology, tagged undocumented SQL on May 15, 2007 | 14 Comments »
Database Consistency Checker (DBCC) commands can gives valuable insight into what’s going on inside SQL Server system. DBCC commands have powerful documented functions and many undocumented capabilities. Current DBCC commands are most useful for performance and troubleshooting exercises.
To learn about all the DBCC commands run following script in query analyzer.
DBCC TRACEON(2520)
DBCC HELP (‘?’)
GO
To learn about [...]
SQL SERVER – 2005 – List all the database
Posted in Pinal Dave, SQL, SQL Authority, SQL Query, SQL Scripts, SQL Server, SQL Stored Procedure, SQL Tips and Tricks, T SQL, Technology, tagged undocumented SQL on May 12, 2007 | 24 Comments »
List all the database on SQL Servers.
All the following Stored Procedure list all the Databases on Server.
I personally use EXEC sp_databases because it gives the same results as other but it is self explaining.
—-SQL SERVER 2005 System Procedures
EXEC sp_databases
EXEC sp_helpdb
—-SQL 2000 Method still works in SQL Server 2005
SELECT name
FROM sys.databases
SELECT name
FROM sys.sysdatabases
—-SQL SERVER Un-Documented [...]
About Pinal Dave
Pinalkumar Dave is a Microsoft SQL Server MVP and a Mentor for Solid Quality India. He has written over 1100 articles on the subject on his blog at http://blog.sqlauthority.com. He is a dynamic and proficient Principal Database Architect, Corporate Trainer and Project Manager, who specializes in SQL Server Programming and has 7 years of hands-on experience. He holds a Masters of Science degree and a number of certifications, including MCDBA and MCAD (.NET). He was awarded Regional Mentor for PASS Asia.
-
Blog Stats
- 10,988,878 Readers
SQLAuthority Links

My Homepage
My Resume
My Other Blog
--------------------
Top Downloads
PDF Downloads
Script Downloads
Script Bank
Favorite Scripts
All Scripts - 1
All Scripts - 2
Top Articles
Best Articles
Favorite Articles - 1
Favorite Articles - 2
--------------------
SQL Interview Q & A
SQL Coding Standards
SQL FAQ Download
--------------------
Jobs @ SQLAuthority
Top 7 Commenters
365 - Imran Mohammed
138- Brian Tkatch
57 - Tejas Shah
56 - Jacob Sebastian
47 - Jerry Hung
46 - Kuldip Bhatt
43 - Ashish GilhotraCategories
- About Me (61)
- Best Practices (91)
- Business Intelligence (14)
- Data Warehousing (30)
- Database (270)
- DBA (126)
- MVP (98)
- Poll (5)
- Readers Contribution (37)
- Readers Question (45)
- Software Development (67)
- SQL Add-On (91)
- SQL Backup and Restore (54)
- SQL BOL (10)
- SQL Coding Standards (20)
- SQL Constraint and Keys (51)
- SQL Cursor (28)
- SQL Data Storage (45)
- SQL DateTime (37)
- SQL Documentation (219)
- SQL Download (222)
- SQL Error Messages (125)
- SQL Function (124)
- SQL Humor (25)
- SQL Index (98)
- SQL Interview Questions and Answers (58)
- SQL Joins (64)
- SQL Optimization (66)
- SQL Performance (223)
- SQL Puzzle (26)
- SQL Security (119)
- SQL Server DBCC (42)
- SQL Server Management Studio (28)
- SQL Stored Procedure (102)
- SQL String (19)
- SQL System Table (50)
- SQL Trigger (24)
- SQL User Group (48)
- SQL Utility (126)
- SQL White Papers (37)
- SQLAuthority (376)
- SQL Training (1)
- SQLAuthority Author Visit (80)
- SQLAuthority Book Review (19)
- SQLAuthority News (346)
- SQLAuthority Website Review (29)
- SQLServer (77)
- Tech (916)
- Pinal Dave (906)
- SQL Scripts (533)
- Technology (1159)
- SQL (1159)
- SQL Authority (1159)
- SQL Query (1159)
- SQL Server (1159)
- SQL Tips and Tricks (1159)
- T SQL (1159)
-
Top Posts
- SQL SERVER - Insert Data From One Table to Another Table - INSERT INTO SELECT - SELECT INTO TABLE
- SQL SERVER - Insert Multiple Records Using One Insert Statement - Use of UNION ALL
- SQL SERVER - Retrieve Current Date Time in SQL Server CURRENT_TIMESTAMP, GETDATE(), {fn NOW()}
- SQL SERVER - Import CSV File Into SQL Server Using Bulk Insert - Load Comma Delimited File Into SQL Server
- SQL SERVER - Convert Text to Numbers (Integer) - CAST and CONVERT
- SQL Server Interview Questions and Answers Complete List Download
- SQL SERVER - 2005 - Create Script to Copy Database Schema and All The Objects - Stored Procedure, Functions, Triggers, Tables, Views, Constraints and All Other Database Objects
- SQL SERVER - Shrinking Truncate Log File - Log Full
- SQL SERVER - Restore Database Backup using SQL Script (T-SQL)
- SQL SERVER - 2005 List All Tables of Database
- SQL SERVER - 2008 - Interview Questions and Answers Complete List Download
- SQL Server Interview Questions and Answers - Part 1
-
Authors
-
pinaldave
- SQLAuthority News – SQL Server 2008 for Oracle DBA
- SQLAuthority News – Book Review – Expert SQL Server 2008 Encryption by Michael Coles
- SQL SERVER – Understanding Table Hints with Examples
- SQL SERVER – Size of Index Table – A Puzzle to Find Index Size for Each Index on Table
- SQL SERVER – 2005 2008 – Backup, Integrity Check and Index Optimization By Ola Hallengren
- SQLAuthority News – Notes of Excellent Experience at SQL PASS 2009 Summit, Seattle
- SQL SERVER – Whitepaper Consolidation Using SQL Server 2008
- SQLAuthority News – Disk Partition Alignment Best Practices for SQL Server
- SQL SERVER – Policy Based Management – Create, Evaluate and Fix Policies
- SQL SERVER – Disable CHECK Constraint – Enable CHECK Constraint
-
Archives
- November 2009
- October 2009
- September 2009
- August 2009
- July 2009
- June 2009
- May 2009
- April 2009
- March 2009
- February 2009
- January 2009
- December 2008
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- March 2007
- February 2007
- January 2007
- December 2006
- November 2006
Pages
Category Cloud
About Me Best Practices Database DBA MVP Pinal Dave Software Development SQL SQL Add-On SQL Authority SQLAuthority Author Visit SQLAuthority News SQL Documentation SQL Download SQL Error Messages SQL Function SQL Index SQL Joins SQL Optimization SQL Performance SQL Query SQL Scripts SQL Security SQLServer SQL Server SQL Stored Procedure SQL Tips and Tricks SQL Utility Technology T SQL


