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…
Read MoreSQL SERVER – Delete Backup History – Cleanup Backup History
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…
Read MoreSQL SERVER – Refresh Database Using T-SQL
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…
Read MoreSQL SERVER – Introduction to CLR – Simple Example of CLR Stored Procedure
CLR is abbreviation of Common Language Runtime. In SQL Server 2005 and later version of it database objects can be created which are created in CLR. Stored Procedures, Functions, Triggers can be coded in CLR. CLR is faster than T-SQL in many cases. CLR is mainly used to accomplish task…
Read MoreSQL SERVER – Renaming SP is Not Good Idea – Renaming Stored Procedure Does Not Update sys.procedures
I have written many articles about renaming a table, columns, and procedures SQL SERVER – How to Rename a Column Name or Table Name, here I found something interesting about renaming the stored procedures and felt like sharing it with you all. Let us learn about how renaming stored procedure does not update sys.procedures.
SQL SERVER – Guidelines and Coding Standards Complete List Download
Coding standards and guidelines are very important for any developer on the path to a 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 they should not prevent best practices for coding. They are basically the guidelines that one should follow for better understanding.