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 →
Remove duplicate records from table
User faced out the duplicate records in below table. Here is problem is that ‘how can remove the duplicate records from table?’ Here I have been explained the how to remove the duplicate records. Show the Below SQL Statement table records. Select * from Employee Here below shown the three employees are duplicate out of... Continue Reading →
Why Eating GHEE?
Really want to know the GHEE. Source: Desi cow milk (A2) : Has many advantages Buffalo milk : Has advantages only for physically active people like farmers /labourers. For others , its disadvanatge Jersy/HF cow milk (A1 milk) : Better to avoid it as lot of internet material indicates not good Preparation method ( we... 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 →
Finding users that are connected to the server — Sandip Prakashbhai Patel
The following example finds the users that are connected to the server and returns the number of sessions for each user. SELECT login_name ,COUNT(session_id) AS session_count FROM sys.dm_exec_sessions GROUP BY login_name; Here a query is displayed the current Login Detail. SELECT c.Session_id, s.host_name, s.login_name, s.login_time, s.cpu_time FROM sys.dm_exec_connections AS c JOIN sys.dm_exec_sessions AS s ON... Continue Reading →