Question of the Month (July)

By | August 3, 2015

Question of the Month Suppose we have a table emp_plan  which contains 4 columns “Empid” (employeeid), Planid (Projectid), Startdate(Allocation Start date) and Enddate (Allocation Enddate). Its structure is given below:-4  Create table emp_plan (empid nvarchar(200),planid nvarchar(20),startdate datetime, enddate datetime) Also below is the script to enter sample data into the table:- insert into emp_plan(empid,planid,startdate,enddate) select ‘001’,’planA’,’2015-05-15′,’2015-05-30′… Read More »

Do you know about Whatsapp web?

By | July 11, 2015

Whatsapp claims that they currently have 500 million users worldwide. That is pretty impressive looking at the good amount of distinctively decent competitors they have within the space of Social Networking communication. Viber, Line, Google Hangout,Facebook Messenger & Hike (Commonly in India). While all these products are growing inch by inch and including new set of features into their product, whatsapp… Read More »

Script to find complete months between two given dates

By | July 10, 2015

Complete months between two given dates Below script will help in finding the complete months within the 2 given dates. In the below script we takes below dates as exampleStartdate =2015-07-05 Enddate =2016-01-06 /**********************Script Start**************************/ IF (object_id(‘tempdb..#month’) is not null) DROP TABLE #month CREATE TABLE #month (id int identity(1,1),MonthStartDate DATETIME,MonthEndDate DATETIME) DECLARE @startdate AS DATETIME… Read More »

Script to find the complete weeks within two given dates

By | July 10, 2015

Complete weeks within two given dates Sometimes we need to find out the complete weeks within two given dates. Below script will help in finding the complete weeks within 2 given dates. In this script, I have used below dates as exampleStartdate=2015-04-12 Enddate=2015-06-10 SET DATEFORMAT YMD if (object_id(‘tempdb..#weekdays’) is not null) drop table #weekdays Declare… Read More »

Importance of Best Practices in database programming

By | February 1, 2015

Best Practices in database programming For any programming language, just writing the code is not well enough. It should be written using the best practices. This article will try to explain the disadvantages of writing code without using Best Practices and later on how best practices can be implemented in our database code. Code written… Read More »

RIGHT() function in SQL Server

By | January 26, 2015

SQL Server – RIGHT () function Right():- This function returns the specified number of characters from the Right part of the given character string.Syntax:- Select RIGHT ( character_expression , integer_expression ) For example, the below query will return two characters from the last. Select RIGHT(‘Vivek’,2) Result ek

LEFT() function in SQL Server

By | January 26, 2015

LEFT() function in SQL Server Left():- This function returns the specified number of characters from the left part of the given character string. Syntax:-Select LEFT ( character_expression , integer_expression ) For example, the below query will return two characters from the beginning Select LEFT  (‘Vivek’,2) Result Vi

SQL Script to find the missing indexes

By | January 25, 2015

Script to find the missing indexes Performance tuning in SQL is important exercise and index creation is an important part of it. Below script will help in finding the missing indexes. Once you create these indexes, it will help in improving the Performance.SELECT db_name(d.database_id) dbname , object_name(d.object_id) tablename , d.equality_columns , d.inequality_columns , d.included_columns ,’CREATE INDEX [missing_index_’ +… Read More »