I love active participation from my readers. Just a day ago I wrote article about SQL SERVER - Simple Use of Cursor to Print All Stored Procedures of Database. I just received comment from Jerry Hung who have improved on previously written article of generating text of Stored Procedure.
DECLARE @procName VARCHAR(100)
DECLARE @getprocName CURSOR
SET @getprocName = CURSOR FOR
SELECT [...]
Archive for the ‘SQL Tips and Tricks’ Category
SQL SERVER - Simple Use of Cursor to Print All Stored Procedures of Database Including Schema
Posted in Author Pinal, Database, SQL, SQL Authority, SQL Documentation, SQL Query, SQL Scripts, SQL Server, SQL Stored Procedure, SQL Tips and Tricks, T SQL, Technology on November 22, 2008 | No Comments »
SQLAuthority News - SQL Server White Paper: SQL Server 2008 Compliance Guide
Posted in SQL, SQL Authority, SQL Documentation, SQL Download, SQL Query, SQL Server, SQL Tips and Tricks, SQLAuthority News, Software Development, T SQL, Technology on November 21, 2008 | 1 Comment »
Organizations across the globe are being inundated with regulatory requirements. They also have a strong need to better manage their IT systems to ensure they are operating efficiently and staying secure. Microsoft is often asked to provide guidance and technology to assist organizations struggling with compliance. The SQL Server 2008 Compliance Guidance white paper was [...]
SQL SERVER - Simple Use of Cursor to Print All Stored Procedures of Database
Posted in Author Pinal, SQL, SQL Authority, SQL Cursor, SQL Query, SQL Scripts, SQL Server, SQL Stored Procedure, SQL Tips and Tricks, T SQL, Technology on November 20, 2008 | 4 Comments »
SQLAuthority Blog reader YordanGeorgiev has submitted very interesting SP, which uses cursor to generate text of all the Stored Procedure of current Database. This task can be done many ways, however, this is also interesting method.
USE AdventureWorks
GO
DECLARE @procName VARCHAR(100)
DECLARE @getprocName CURSOR
SET @getprocName = CURSOR FOR
SELECT s.name
FROM sysobjects s
WHERE type = ‘P’
OPEN @getprocName
FETCH NEXT
FROM @getprocName INTO @procName
WHILE @@FETCH_STATUS = [...]
SQLAuthority News - Author Visit - South Asia MVP Open Day 2008 - Goa - Group Photo
Posted in About Me, Author Pinal, DBA, SQL, SQL Authority, SQL MVP, SQL Query, SQL Server, SQL Tips and Tricks, SQLAuthority Author Visit, SQLAuthority News, T SQL, Technology, tagged MVP, Openday on November 19, 2008 | 3 Comments »
MVP Open day 2008 is one of the best event happened so far. I have previously written about this event in detail on this blog.
SQLAuthority News - Author Visit - South Asia MVP Open Day 2008 - Goa - Link List
SQLAuthority News - Author Visit - South Asia MVP Open Day 2008 - Goa - [...]
SQLAuthority News - Author Visit - South Asia MVP Open Day 2008 - Goa - Day 3
Posted in Database, SQL, SQL Authority, SQL MVP, SQL Query, SQL Server, SQL Tips and Tricks, SQLAuthority Author Visit, SQLAuthority News, T SQL, Technology, tagged MVP, Openday on November 18, 2008 | 1 Comment »
Yesterday was our last day at South Asia MVP Open Day. For three days continuously we are having great time along with fellow MVP. Every MVP was having great time because the way whole event was planned. We had plenty of time for networking as well lots of interesting sessions were going on.
Most of the [...]
SQLAuthority News - Author Visit - South Asia MVP Open Day 2008 - Goa - Day 2
Posted in About Me, SQL, SQL Authority, SQL MVP, SQL Query, SQL Server, SQL Tips and Tricks, SQLAuthority Author Visit, SQLAuthority News, T SQL, Technology, tagged MVP, Openday on November 17, 2008 | 1 Comment »
At MVP Open Day we were promised that we will have 8 to 8 action packed day but we all observed much longer hours where we all MVP’s were busy with activity. I will say instead of 8 AM to 8 PM we actually had fun from 8 AM to 2 AM (next day).
Day 2 [...]
SQLAuthority News - Author Visit - South Asia MVP Open Day 2008 - Goa - Day 1
Posted in About Me, SQL, SQL Authority, SQL MVP, SQL Query, SQL Server, SQL Tips and Tricks, SQLAuthority Author Visit, SQLAuthority News, T SQL, Technology, tagged MVP, Openday on November 16, 2008 | 5 Comments »
It is great fun! Perfect Event and Great start.
Yesterday I wrote about agenda of South Asia MVP Open Day 2008 which is at Hotel Kenilworth Resorts, Goa. November 15 - Day 1 of Open Day started with plain journey and ended with Goan Team Party at beach with fellow MVP.
I have more than hundreds of [...]
SQLAuthority News - Author Visit - South Asia MVP Open Day 2008 - Goa - Link List
Posted in About Me, SQL, SQL Authority, SQL MVP, SQL Query, SQL Server, SQL Tips and Tricks, SQLAuthority Author Visit, SQLAuthority News, T SQL, Technology, tagged MVP, Openday on November 15, 2008 | 1 Comment »
Today is very exciting day as I will start my trip to South Asia MVP Open Day 2008 - Goa. Yesterday I wrote about my visit. I will be attending South Asia MVP Open Day 2008 on November 15 - 17, 2008 at Hotel Kenilworth Resorts, Goa. Those who have asked how can they meet [...]
SQLAuthority News - Author Visit - South Asia MVP Open Day 2008 - Goa
Posted in About Me, Author Pinal, SQL, SQL Authority, SQL MVP, SQL Query, SQL Server, SQL Tips and Tricks, SQLAuthority Author Visit, SQLAuthority News, T SQL, Technology, tagged MVP, Openday on November 14, 2008 | No Comments »
I will be attending South Asia MVP Open Day 2008 on November 15 - 17, 2008 at Hotel Kenilworth Resorts, Goa. I am very excited as this will be my first Open Day event after being MVP. Microsoft Most Valuable Professionals (MVPs) are exceptional technical community leaders from around the world who are awarded for [...]
SQLAuthority News - RML Utilities - Usage and Additional Help
Posted in SQL, SQL Authority, SQL Documentation, SQL Download, SQL Performance, SQL Query, SQL Server, SQL Tips and Tricks, SQLAuthority News, T SQL, Technology on November 13, 2008 | No Comments »
Yesterday I wrote about SQLAuthority News - Download RML Utilities for SQL Server. I received many emails where different developers requested how to find additional help regarding RML Utilities. Few users reported that they are not able to install RML Utilities because of some reporting service pre-requisite.
If RML Utilities are not being installed due to [...]
SQLAuthority News - Download RML Utilities for SQL Server
Posted in Best Practices, Database, SQL, SQL Authority, SQL Documentation, SQL Download, SQL Performance, SQL Query, SQL Security, SQL Server, SQL Tips and Tricks, SQLAuthority News, T SQL, Technology on November 12, 2008 | 1 Comment »
The RML utilities allow you to process SQL Server trace files and view reports showing how SQL Server is performing. For example, you can quickly see:
Which application, database or login is using the most resources, and which queries are responsible for that
Whether there were any plan changes for a batch during the time when the [...]
SQL SERVER - Delete Backup History - Cleanup Backup History
Posted in Author Pinal, Best Practices, Database, SQL, SQL Authority, SQL Backup and Restore, SQL Query, SQL Scripts, SQL Server, SQL Stored Procedure, SQL Tips and Tricks, T SQL, Technology on November 11, 2008 | 3 Comments »
SQL Server stores history of all the taken backup forever. History of all the backup is stored in msdb database. Many times older history is no more required. Following Stored Procedure can be executed with parameter which takes days of history to keep. In following example 30 is passed to keep history of month.
USE msdb
GO
DECLARE [...]
SQL SERVER - Check Database Integrity for All Databases of Server
Posted in Author Pinal, Best Practices, SQL, SQL Authority, SQL Query, SQL Scripts, SQL Server, SQL Server DBCC, SQL Tips and Tricks, T SQL, Technology on November 10, 2008 | No Comments »
Today we will see quick script which will check integrity of all the database of SQL Server.
EXEC sp_msforeachdb ‘DBCC CHECKDB(”?”)’
Above script will return you lots of messages in resultset. If there are any errors in resultset they will be displayed in red text. If everything is black text there is no error. Typical output of [...]
SQLAuthority News - SQL Server 2008 Book Online Updated in October 2008
Posted in SQL, SQL Authority, SQL Documentation, SQL Download, SQL Query, SQL Server, SQL Tips and Tricks, SQLAuthority News, T SQL, Technology on November 9, 2008 | 3 Comments »
SQL Server 2008 Books Online is updated on 31 October 2008. I always bookmark latest BOL for my easy reference.
Getting Started: New and Updated Topics (31 October 2008)
Analysis Services - Multidimensional Data: New and Updated Topics (31 October 2008)
Database Engine: New and Updated Topics (31 October 2008)
Integration Services: New and Updated Topics (31 October 2008)
Analysis [...]
SQL SERVER 2008 - Connect Visual Studio 2005 Patch Download
Posted in SQL, SQL Add-On, SQL Authority, SQL Download, SQL Query, SQL Server, SQL Tips and Tricks, SQLAuthority News, T SQL, Technology on November 8, 2008 | No Comments »
It was not possible to connect SQL Server 2008 to Visual Studio 2005 so far. Microsoft has released Service Pack once it is installed SQL Server 2008 can be connected to Visual Studio 2005.
Download Microsoft Visual Studio 2005 Service Pack 1 Update for Microsoft SQL Server 2008 Support
For connecting SQL Server 2008 to Visual Studio [...]
SQL SERVER - Refresh Database Using T-SQL
Posted in Author Pinal, SQL, SQL Authority, SQL Performance, SQL Query, SQL Scripts, SQL Server, SQL Server DBCC, SQL Stored Procedure, SQL Tips and Tricks, T SQL, Technology on November 7, 2008 | 2 Comments »
Yesterday I received following questions on blog. Ashish Agarwal asked following question.
Hi Pinal,
Can we refresh a database (like we do by right clicking database node in object explorer and clicking on refresh) thru SQL Query?
If yes, can you please tell me the query?
Thanks,
Ashish Agarwal
Answer to above question is NO. It is not possible to do [...]
SQLAuthority News - 5 Millions Visitors - 2 Anniversary - Authors Note on Economy Slow Down and Job Opportunity - SQL Server
Posted in About Me, Author Pinal, Best Practices, DBA, Database, SQL, SQL Authority, SQL Query, SQL Server, SQL Tips and Tricks, SQLAuthority News, T SQL, Technology on November 6, 2008 | 4 Comments »
I just received following screen shot from one of the regular reader of SQLAuthority.com blog. He pointed out important milestone for our blog. We have crossed 5 millions visitors. In less than 2 years SQLAuthority.com blog has been visited by 5 millions visitors. I even missed the anniversary our blog. On November 1st 2008 SQLAuthority.com [...]
SQL SERVER - Clear Drop Down List of Recent Connection From SQL Server Management Studio
Posted in Author Pinal, Best Practices, DBA, Database, SQL, SQL Add-On, SQL Authority, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, T SQL, Technology on November 5, 2008 | 1 Comment »
Quite often it happens that SQL Server Management Studio’s Dropdown box is cluttered with many different SQL Server’s name. Sometime it contains the name of the server which does not exist or developer does not have access to it. It is very easy to clean the list and start over.
Delete mru.dat file from following location.
For [...]
SQL SERVER - Fix : Error: 4064 - Cannot open user default database. Login failed. Login failed for user
Posted in Author Pinal, SQL, SQL Authority, SQL Error Messages, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, T SQL, Technology on November 4, 2008 | 1 Comment »
I have received following question nearly 10 times in last week though emails. Many users have received following error while connecting to the database. This error happens when database is dropped for which is default for some of the database user. When user try to login and their default database is dropped following error shows [...]
SQLAuthority News - SQL Server Security Whitepapers
Posted in SQL, SQL Authority, SQL Documentation, SQL Download, SQL Query, SQL Security, SQL Server, SQL Tips and Tricks, SQLAuthority News, T SQL, Technology on November 3, 2008 | 1 Comment »
Microsoft has published following three security related white papers. I suggest to all my readers to read them. Read the summary know what is covered in those white papers.
Engine Separation of Duties for the Application Developer - Separation of duties is an important consideration for databases and database applications. By properly defining schemas and roles, [...]
-
About Pinal Dave
Pinalkumar Dave is Microsoft SQL Server MVP and author of over 700 SQL Server articles. He has five years experience as Principal Database Administrator in MS SQL Server 2008/2005, .NET (C#) and ColdFusion MX. He has a Masters of Science degree in Computer Networks, along with MCDBA, MCAD(.NET) and ColdFusion Advanced MX Certifications.
MVP Profile

-
Blog Stats
- 5,224,047 Readers
-
SQLAuthority Links

My Homepage
My Resume
My Other Blog
SQL Server Mag Articles
--------------------
SQLAuthority
Best Articles
Favorite Articles
SQL Script Bank
Top Downloads
--------------------
SQL Interview Q & A
SQL Coding Standards
SQL FAQ Download
--------------------
SQL Random Article
Search SQLAuthority
Subscribe Email Update
SQLAuthority Feed
Translate SQLAuthority
--------------------
Jobs @ SQLAuthority
Find Your IP
Categories
- About Me (35)
- Author Pinal (509)
- Best Practices (39)
- Data Warehousing (25)
- Database (226)
- DBA (198)
- Main (67)
- Outsourcing Technology (4)
- Software Development (73)
- SQL (777)
- SQL Add-On (65)
- SQL Authority (777)
- SQL Backup and Restore (48)
- SQL Coding Standards (84)
- SQL Constraint and Keys (45)
- SQL Cursor (63)
- SQL Data Storage (19)
- SQL DateTime (33)
- SQL DMV (1)
- SQL Documentation (280)
- SQL Download (419)
- SQL Error Messages (360)
- SQL Function (96)
- SQL Humor (21)
- SQL Index (67)
- SQL Interview Questions and Answers (57)
- SQL Joins (357)
- SQL MVP (20)
- SQL Performance (406)
- SQL Puzzle (7)
- SQL Query (777)
- SQL Scripts (512)
- SQL Security (365)
- SQL Server (777)
- SQL Server DBCC (253)
- SQL Stored Procedure (131)
- SQL Tips and Tricks (777)
- SQL Trigger (40)
- SQL User Group (11)
- SQL Utility (55)
- SQL XML (2)
- SQLAuthority (17)
- SQLAuthority Author Visit (32)
- SQLAuthority Book Review (29)
- SQLAuthority News (149)
- SQLAuthority Website Review (18)
- T SQL (777)
- Technology (777)
-
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 - 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 - Import CSV File Into SQL Server Using Bulk Insert - Load Comma Delimited File Into SQL Server
- SQL SERVER - Retrieve Current Date Time in SQL Server CURRENT_TIMESTAMP, GETDATE(), {fn NOW()}
- SQL SERVER - Restore Database Backup using SQL Script (T-SQL)
- SQL Server Interview Questions and Answers Complete List Download
- SQL SERVER - Convert Text to Numbers (Integer) - CAST and CONVERT
- SQL SERVER - 2005 List All Tables of Database
- SQL SERVER - TRIM() Function - UDF TRIM()
- SQL SERVER - Shrinking Truncate Log File - Log Full
- SQL SERVER - Fix : Error: 18452 Login failed for user '(null)'. The user is not associated with a trusted SQL Server connection.
-
Recent Posts
- SQL SERVER - Simple Use of Cursor to Print All Stored Procedures of Database Including Schema
- SQLAuthority News - SQL Server White Paper: SQL Server 2008 Compliance Guide
- SQL SERVER - Simple Use of Cursor to Print All Stored Procedures of Database
- SQLAuthority News - Author Visit - South Asia MVP Open Day 2008 - Goa - Group Photo
- SQLAuthority News - Author Visit - South Asia MVP Open Day 2008 - Goa - Day 3
- SQLAuthority News - Author Visit - South Asia MVP Open Day 2008 - Goa - Day 2
- SQLAuthority News - Author Visit - South Asia MVP Open Day 2008 - Goa - Day 1
- SQLAuthority News - Author Visit - South Asia MVP Open Day 2008 - Goa - Link List
- SQLAuthority News - Author Visit - South Asia MVP Open Day 2008 - Goa
- SQLAuthority News - RML Utilities - Usage and Additional Help
- SQLAuthority News - Download RML Utilities for SQL Server
- SQL SERVER - Delete Backup History - Cleanup Backup History
- SQL SERVER - Check Database Integrity for All Databases of Server
- SQLAuthority News - SQL Server 2008 Book Online Updated in October 2008
- SQL SERVER 2008 - Connect Visual Studio 2005 Patch Download
-
Recent Comments
- COBRASoft on SQL SERVER - 2005 - Database Table Partitioning Tutorial - How to Horizontal Partition Database Table
- SQL SERVER - Simple Use of Cursor to Print All Stored Procedures of Database Including Schema Journey to SQL Authority with Pinal Dave on SQL SERVER - Simple Use of Cursor to Print All Stored Procedures of Database
- Steve Hatchard on SQL SERVER - Difference between DISTINCT and GROUP BY - Distinct vs Group By
- Igor on SQL SERVER - FIX : Error 945 Database cannot be opened due to inaccessible files or insufficient memory or disk space. See the SQL Server error log for details
- Rosales on SQL SERVER - Retrieve Current Date Time in SQL Server CURRENT_TIMESTAMP, GETDATE(), {fn NOW()}
- Kunal Kumar on Contact Me
- Lutz Mueller on SQL SERVER - SELECT 1 vs SELECT * - An Interesting Observation
- Steve Walker on 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
- Rahul on SQL SERVER - 2005 - Display Fragmentation Information of Data and Indexes of Database Table
- Rahul on SQL SERVER - 2005 - Display Fragmentation Information of Data and Indexes of Database Table
- Makarov on Contact Me
- babu on SQL SERVER - Do Not Store Images in Database - Store Location of Images (URL)
- paresh13 on SQL SERVER - 2005 List All Tables of Database
- Manish on 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
- pinaldave on SQLAuthority News - Author Visit - South Asia MVP Open Day 2008 - Goa - Day 1
Archives
- 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
-
Latest Articles
-
pinaldave
- SQL SERVER - Simple Use of Cursor to Print All Stored Procedures of Database Including Schema
- SQLAuthority News - SQL Server White Paper: SQL Server 2008 Compliance Guide
- SQL SERVER - Simple Use of Cursor to Print All Stored Procedures of Database
- SQLAuthority News - Author Visit - South Asia MVP Open Day 2008 - Goa - Group Photo
- SQLAuthority News - Author Visit - South Asia MVP Open Day 2008 - Goa - Day 3
- SQLAuthority News - Author Visit - South Asia MVP Open Day 2008 - Goa - Day 2
- SQLAuthority News - Author Visit - South Asia MVP Open Day 2008 - Goa - Day 1
- SQLAuthority News - Author Visit - South Asia MVP Open Day 2008 - Goa - Link List
- SQLAuthority News - Author Visit - South Asia MVP Open Day 2008 - Goa
- SQLAuthority News - RML Utilities - Usage and Additional Help
-
-
Click Cloud
About Me Author Pinal Best Practices Database Data Warehousing DBA Main Outsourcing Technology Software Development SQL SQL Add-On SQLAuthority SQL Authority SQLAuthority Author Visit SQLAuthority Book Review SQLAuthority News SQLAuthority Website Review SQL Backup and Restore SQL Coding Standards SQL Constraint and Keys SQL Cursor SQL Data Storage SQL DateTime SQL DMV SQL Documentation SQL Download SQL Error Messages SQL Function SQL Humor SQL Index SQL Interview Questions and Answers SQL Joins SQL MVP SQL Performance SQL Puzzle SQL Query SQL Scripts SQL Security SQL Server SQL Server DBCC SQL Stored Procedure SQL Tips and Tricks SQL Trigger SQL User Group SQL Utility SQL XML Technology T SQL


