CASE Expression in Select Statement.

T-SQL supports a number of functions that can be considered as abbreviates of the CASE expression. Many Developers incorrectly refer to CASE as a statement. Ad-hock query statement performs some kind of action or control of flow of the code, and that’s not what CASE does; CASE returns a value and hence is an expression.... Continue Reading →

SQL Server – Database Size Growth Summary

Here the SQL Script written for finding the Database size periodically and use it for Power BI desktop to analysis the database size growth periodically to the System admin and management department. Create the table for storing the daily basis database size infromation. CREATE TABLE DatabaseFileSize ( [database_id] INT, [file_id] INT, [file_type_desc] NVARCHAR(120), [name] NVARCHAR(128), [physical_name] NVARCHAR(520),... Continue Reading →

Difference Between CURRENT_TIMESTAMP and GETDATE()

As a SQL Professional, think a below common question raised! “What is difference between CURRENT_TIMESTAMP and GETDATE () in SQL server?” Basically, in SQL Server GETDATE() is Equivalent to CURRENT_TIMESTAMP. However, if you use CURRENT_TIMESTAMP in your select statement it will work fine. We can see in the above example – both system functions returns the same value.... Continue Reading →

Exclude Weekend days from Given date range.

Get the Total working days from given start and end date. And it also remove sunday and saturday from passing date rang. Means excludes the weekend.   ****** Object: UserDefinedFunction [dbo].[UDF_GetWorkDaysRemoveWeekend] Script Date: 4/30/2019 12:45:59 AM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER FUNCTION [dbo].[UDF_GetWorkDaysRemoveWeekend] /* CREATED BY : SANDIP PATEL CREATED... Continue Reading →

Sum Total Hours and Minutes.

Administration required to know the how may time taken for completion of task or project during given a time span. Every Company need to make sure total number of staff work on particular project, so that getting summarized following heads like total time, resources, input material and what is output. Here is function is created... Continue Reading →

MongoDB (NoSQL database)

There are many factors which gives NoSQL Databases an edge over the conventional RDBMS. I will list down 3 which I think are the most important No Fixed Schema : This, if feel is the biggest advantage of NoSQL databases. One doesn't need to know the structure of data before hand as it is with the... Continue Reading →

Region Wise time zone Convert

Application User wise region time zone is different. If we have a single data server use for different countries. So that time may be create an issue for calculating the time or filtering a records based on time zone. Project Manager and Database developer has always keep in mind regarding time ‘how to manage?’ Here... Continue Reading →

SET ROWCOUNT (Transact-SQL)

SQL Server to stop processing the query after the specified number of rows are returned. To set this option off so that all rows are returned, specify SET ROWCOUNT 0. Setting the SET ROWCOUNT option causes most Transact-SQL statements to stop processing when they have been affected by the specified number of rows. This includes... Continue Reading →

Manually set a new current identity value for the identity column.

Resetting the current identity value, if it is needed The following example resets the current identity value, if it is needed, of the specified table in the database. DBCC CHECKIDENT ('dbo.CityMaster'); GO Reporting the current identity value The following example reports the current identity value in the specified table in database, and does not correct... Continue Reading →

Six Different ways to find table rows.

You can write below Queries into SQL query window. And you can select a database, on which you need to get row count of specific table. You can use COUNT(*) function in sql statement Select count(*) from dbo.UserMaster You can use COUNT(1) function in sql statement Select count(1) from dbo.UserMaster You can use aggregate function,... Continue Reading →

Create a free website or blog at WordPress.com.

Up ↑

Design a site like this with WordPress.com
Get started