-
To make the T-SQL function DATEADD more dynamic use variables. The example below, accepts an input parameter, in this case “4”. All events older than 4 months from now will be deleted. DECLARE @months int SET @months = 4 DELETE FROM [Events] WHERE [EventDate] < DATEADD (month,-1*@months, getdate(...
-
This is just for Fun. The following code is unformatted, unclear and may be confusing. But curious to know the result? Set the result mode of the query window to Text . While you are in Query Window press CONTROL+T and run the following code and see what it returns. set nocount on select case no when...
-
A few weeks ago, I wrote a post related to the tempdb where I attempted to answer the question – Is TempDB a copy of the model database? The post attracted a couple of follow-up comments (which I really appreciate, because it gives everyone a great deal to think about) and led me to a thought-filled...
Posted to
Nakul's Blog
by
Nakul Vachhrajani
on
12-04-2011
Filed under:
Filed under: Development, Administration, T-SQL, Tips, SQL Server, #SQLServer, #TSQL, Best Practices, Guidance, DBA, Debugging
-
Recently I have posted some of the articles and some just learned from the month of October. This article just summarize all the posts which recently published. You can find the links below to go in the details. Blog Posts: Database Backup Compression, Amazing feature for DBA Multi Monitor Support of...
Posted to
sqlideas
by
Paresh Prajapati
on
12-01-2011
Filed under:
Filed under: sql, tsql, sql server, ms sql, ms sql server, t-sql, new features, #SQL Server, #sql, database, sql server general, enhancements, SQL Scripts, SQL new features, JustLearned, query
-
Table variables and Temporary tables are used interchangeably – but they were designed for different purposes. Temporary tables were designed for storage and manipulation of temporal data. Table variables were designed to return User Defined Function (UDF) datasets. Which type should be used ? If I estimate...
-
Based on popular demand from my colleagues and you, the kind reader, I am currently writing a series of posts on the SQL Server Profiler. Five parts have been published till date, and for your kind reference, here are the links to them: What is a SQL Trace? Permissions, space requirements and launching...
Posted to
Nakul's Blog
by
Nakul Vachhrajani
on
11-30-2011
Filed under:
Filed under: Development, Administration, T-SQL, Performance Tuning, Tips, SQL Server, #SQLServer, #TSQL, Best Practices, Guidance, DBA, SSMS, Tools and Utilities, Series, Debugging
-
Production Database servers may have databases which are heavily in size. For the maintenance of those database backups are very hard and lengthy as the backups of those heavily databases take more tome to execute and very CPU, memory and IO consumptive. And important thing is backups activity should...
Posted to
sqlideas
by
Paresh Prajapati
on
11-30-2011
Filed under:
Filed under: sql server 2008, tsql, sql server, ms sql, ms sql server, t-sql, #SQL Server, #sql, database, enhancements, SQL Scripts, SQL new features, backup, Performance
-
I had blogged about Different ways to know structure of the tables . One of the methods is to highlight the object name and press Alt+F1. But this will not work if the object name contains multiparts ie database name, owner name etc. Consider the following object sys.objects Applying Alt+F1 will lead...
-
With SQL Server 2012 a new string function is born – CONCAT(). The output is a string, as the result of the concatenation of two or more strings – if the input is another type than string a conversion will be done implicit. The CONCAT() function takes between 2 and 254 parameters. Here is how the syntax...
-
Based on popular demand from my colleagues and you, the kind reader, I am currently writing a series of posts on the SQL Server Profiler. Four parts have been published till date, and for your kind reference, here are the links to them: What is a SQL Trace? Permissions, space requirements and launching...
Posted to
Nakul's Blog
by
Nakul Vachhrajani
on
11-27-2011
Filed under:
Filed under: Development, Administration, T-SQL, Performance Tuning, Tips, SQL Server, Denali, #SQLServer, #TSQL, Best Practices, SSMS, Tools and Utilities, Series, Debugging
-
Based on popular demand from my colleagues and you, the kind reader, I am currently writing a series of posts on the SQL Server Profiler. Three parts have been published till date, and for your kind reference, here are the links to them: What is a SQL Trace? Permissions, space requirements and launching...
Posted to
Nakul's Blog
by
Nakul Vachhrajani
on
11-23-2011
Filed under:
Filed under: Development, Administration, T-SQL, Performance Tuning, Tips, SQL Server, Denali, #SQLServer, #TSQL, Best Practices, SSMS, Tools and Utilities, Series, Debugging
-
There are many aggregate functions available in SQL Server. One thing that most of the people forget is that Aggregate functions always return atleast a row no matter if there are rows in the table or where clause returns or does not return any resultset Consider the following example declare @t table...
-
Based on popular demand from my colleagues and you, the kind reader, I am currently writing a series of posts on the SQL Server Profiler. The first part was an introduction attempting to answer the question - What is a SQL Trace? Permissions, space requirements and launching the Profiler . The second...
Posted to
Nakul's Blog
by
Nakul Vachhrajani
on
11-20-2011
Filed under:
Filed under: Development, Administration, T-SQL, Performance Tuning, Tips, SQL Server, #SQLServer, Best Practices, Guidance, SSMS, Tools and Utilities, Series, Debugging
-
Recently while working with SQL CLR functionality and created DLL for the SQL CLR. But while registering this DLL in the database i got one surprised error. Lt's show you the script so you have more idea. We have a script to register DLL as following, SP_CONFIGURE 'clr enabled',1 GO RECONFIGURE...
Posted to
sqlideas
by
Paresh Prajapati
on
11-19-2011
Filed under:
Filed under: sql, sql server 2008, sql server 2005, tsql, sql server, ms sql, ms sql server, t-sql, sql server 2011, database, sql server general, SQL Scripts, sql errors, SQL Server Problems, SQL CLR
-
Based on popular demand from my colleagues and you, the kind reader, I am currently writing a series of posts on the SQL Server Profiler. You can read the first part on What is a SQL Trace? Permissions, space requirements and launching the Profiler . Today, we will attempt to answer the following questions...
Posted to
Nakul's Blog
by
Nakul Vachhrajani
on
11-16-2011
Filed under:
Filed under: Development, Administration, T-SQL, Performance Tuning, Tips, SQL Server, #SQLServer, #TSQL, Best Practices, Guidance, SSMS, Tools and Utilities, Series, Debugging