I just wrote down following script very quickly for one of the project which I am working on. The requirement of the project was that every index existed in database should be rebuilt with fillfactor of 80. One common question I receive why fillfactor 80, answer is I just think having it 80 will do [...]
Archive for the ‘SQL Cursor’ Category
SQL SERVER – 2008 – 2005 – Rebuild Every Index of All Tables of Database – Rebuild Index with FillFactor
Posted in Pinal Dave, SQL, SQL Authority, SQL Cursor, SQL Index, SQL Optimization, SQL Performance, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, SQLAuthority News, T SQL, Technology on January 30, 2009 | 5 Comments »
SQL SERVER – Simple Use of Cursor to Print All Stored Procedures of Database
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 on November 20, 2008 | 5 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 = [...]
SQL SERVER – Guidelines and Coding Standards Complete List Download
Posted in Best Practices, DBA, Data Warehousing, Database, Pinal Dave, SQL, SQL Authority, SQL Coding Standards, SQL Constraint and Keys, SQL Cursor, SQL Data Storage, SQL Documentation, SQL Download, SQL Function, SQL Index, SQL Joins, SQL Performance, SQL Query, SQL Scripts, SQL Security, SQL Server, SQL Stored Procedure, SQL Tips and Tricks, SQL Trigger, SQL Utility, SQLAuthority, T SQL, Technology on September 25, 2008 | 9 Comments »
SQL SERVER – Guidelines and Coding Standards complete List Download
Coding standards and guidelines are very important for any developer on the path of successful career. A coding standard is a set of guidelines, rules and regulations on how to write code. Coding standards should be flexible enough or should take care of the situation where [...]
SQL SERVER – 2008 – Interview Questions and Answers Complete List Download
Posted in Database, Pinal Dave, SQL, SQL Authority, SQL Constraint and Keys, SQL Cursor, SQL Data Storage, SQL DateTime, SQL Documentation, SQL Download, SQL Error Messages, SQL Function, SQL Index, SQL Interview Questions and Answers, SQL Joins, SQL Performance, SQL Query, SQL Scripts, SQL Security, SQL Server, SQL Server DBCC, SQL Stored Procedure, SQL Tips and Tricks, SQL Trigger, SQL Utility, SQLAuthority, T SQL, Technology, tagged SQL XML on September 20, 2008 | 54 Comments »
Download SQL Server 2008 Interview Questions and Answers Complete List
Interview is very important event for any person. A good interview leads to good career if candidate is willing to learn. I always enjoy interview questions and answers series. This is my very humble attempt to write SQL Server 2008 interview questions and answers. SQL Server [...]
SQL SERVER – 2008 – Interview Questions and Answers – Part 2
Posted in Data Warehousing, Pinal Dave, SQL, SQL Authority, SQL Constraint and Keys, SQL Cursor, SQL Function, SQL Index, SQL Interview Questions and Answers, SQL Joins, SQL Query, SQL Scripts, SQL Server, SQL Stored Procedure, SQL Tips and Tricks, SQLAuthority, T SQL, Technology on September 13, 2008 | 11 Comments »
SQL SERVER – 2008 – Interview Questions and Answers Complete List Download
1) General Questions of SQL SERVER
What is Cursor?
Cursor is a database object used by applications to manipulate data in a set on a row-by-row basis, instead of the typical SQL commands that operate on all the rows in the set at one time.
In [...]
SQL SERVER – Readers Contribution to Site – Simple Example of Cursor
Posted in Readers Contribution, Readers Question, SQL, SQL Authority, SQL Cursor, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, T SQL, Technology on July 16, 2008 | 1 Comment »
eaders are very important to me. Without their active participation this site would not be the community helping web site. I encourage readers participation and request that you help other users with your knowledge.
I recently come across very good communication between two of blog readers. I want to thank you Imran Mohammed for taking time [...]
SQL SERVER – Is Cursor Database Object or Datatype
Posted in Pinal Dave, SQL, SQL Authority, SQL Cursor, SQL Query, SQL Server, SQL Tips and Tricks, T SQL, Technology on April 19, 2008 | 9 Comments »
It is commonly believed that cursor are Database Objects. I have always given the definition of cursor as SQL Server cursors are database objects used to manipulate data in a set on a row-by-row basis.
Just a few days ago – Imran one of the active reader of blog asked me question if cursor is database [...]
SQL SERVER – Simple Example of Cursor – Sample Cursor Part 2
Posted in Pinal Dave, SQL, SQL Authority, SQL Cursor, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, T SQL, Technology on March 5, 2008 | 26 Comments »
I have recently received email that I should update SQL SERVER – Simple Example of Cursor with example of AdventureWorks database.
Simple Example of Cursor using AdventureWorks Database is listed here.
USE AdventureWorks
GO
DECLARE @ProductID INT
DECLARE @getProductID CURSOR
SET @getProductID = CURSOR FOR
SELECT ProductID
FROM Production.Product
OPEN @getProductID
FETCH NEXT
FROM @getProductID INTO @ProductID
WHILE @@FETCH_STATUS = 0
BEGIN
PRINT @ProductID
FETCH NEXT
FROM @getProductID INTO @ProductID
END
CLOSE @getProductID
DEALLOCATE @getProductID
GO
Reference : [...]
SQLAuthority News – Best Articles on SQLAuthority.com
Posted in DBA, Data Warehousing, Database, Pinal Dave, SQL, SQL Add-On, SQL Authority, SQL Backup and Restore, SQL Coding Standards, SQL Constraint and Keys, SQL Cursor, SQL DateTime, SQL Documentation, SQL Download, SQL Error Messages, SQL Function, SQL Humor, SQL Index, SQL Interview Questions and Answers, SQL Joins, SQL Performance, SQL Query, SQL Scripts, SQL Security, SQL Server, SQL Server DBCC, SQL Stored Procedure, SQL Tips and Tricks, SQL Trigger, SQL Utility, Software Development, T SQL, Technology on November 4, 2007 | 5 Comments »
SQL SERVER – Cursor to Kill All Process in Database
SQL SERVER – Find Stored Procedure Related to Table in Database – Search in All Stored procedure
SQL SERVER – Shrinking Truncate Log File – Log Full
SQL SERVER – Simple Example of Cursor
SQL SERVER – UDF – Function to Convert Text String to Title Case – Proper [...]
SQL SERVER – Simple Example of WHILE Loop With CONTINUE and BREAK Keywords
Posted in Pinal Dave, SQL, SQL Authority, SQL Cursor, SQL Function, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, T SQL, Technology on October 24, 2007 | 34 Comments »
This is question is one of those question which is very simple and most of the users get it correct, however few users find it confusing for first time. I have tried to explain the usage of simple WHILE loop in first example. BREAK keyword will exit the stop the while loop and control is [...]
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,853,057 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
357 - Imran Mohammed
135- Brian Tkatch
55 - Tejas Shah
54 - Jacob Sebastian
47 - Jerry Hung
46 - Kuldip Bhatt
42 - Ashish GilhotraCategories
- About Me (61)
- Best Practices (91)
- Business Intelligence (14)
- Data Warehousing (30)
- Database (268)
- DBA (124)
- MVP (97)
- Poll (5)
- Readers Contribution (37)
- Readers Question (44)
- 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 (218)
- SQL Download (222)
- SQL Error Messages (125)
- SQL Function (124)
- SQL Humor (25)
- SQL Index (96)
- SQL Interview Questions and Answers (58)
- SQL Joins (63)
- SQL Optimization (65)
- SQL Performance (221)
- SQL Puzzle (25)
- SQL Security (119)
- SQL Server DBCC (42)
- SQL Server Management Studio (28)
- SQL Stored Procedure (101)
- SQL String (19)
- SQL System Table (50)
- SQL Trigger (24)
- SQL User Group (48)
- SQL Utility (126)
- SQL White Papers (36)
- SQLAuthority (371)
- SQL Training (1)
- SQLAuthority Author Visit (80)
- SQLAuthority Book Review (18)
- SQLAuthority News (341)
- SQLAuthority Website Review (28)
- SQLServer (74)
- Tech (910)
- Pinal Dave (900)
- SQL Scripts (531)
- Technology (1152)
- SQL (1152)
- SQL Authority (1152)
- SQL Query (1152)
- SQL Server (1152)
- SQL Tips and Tricks (1152)
- T SQL (1152)
-
Top Posts
- SQL SERVER - Insert Data From One Table to Another Table - INSERT INTO SELECT - SELECT INTO TABLE
- SQL Server Interview Questions and Answers Complete List Download
- 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 - 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 - 2005 NorthWind Database or AdventureWorks Database - Samples Databases
- SQL SERVER - 2008 - Interview Questions and Answers Complete List Download
- SQL SERVER - FIX : ERROR : (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (Microsoft SQL Server, Error: )
- SQL SERVER - Restore Database Backup using SQL Script (T-SQL)
-
Authors
-
pinaldave
- 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
- SQL SERVER – Sharepoint Resource Available for SQL Server
- SQL Authority News – Training MS SQL Server 2005/2008 Query Optimization And Performance Tuning
- SQL SERVER – Removing Key Lookup – Seek Predicate – Predicate – An Interesting Observation Related to Datatypes
- SQL SERVER – Stored Procedure are Compiled on First Run – SP taking Longer to Run First Time
- SQLAuthority News – Data Compression Strategy Capacity Planning and Best Practices
- SQLAuthority News – SQL PASS Summit, Seattle 2009 – Day 4
- SQLAuthority News – SQL PASS Summit, Seattle 2009 – Day 3
-
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


