Headder AdSence

how to get pm/am datetime in T-SQL server


SELECT GETDATE() ActualDateTime,FORMAT(GETDATE(),'MM/dd/yyyy HH:mm:ss tt') TransformedDateTime;


 

how to get first day of month in snowflake

 we have a function in the snowflake, that will truncate the month/year from the given date.


here are few examples.

1. Using Current_Date function

SELECT CURRENT_DATE() AS Today_Date,DATE_TRUNC(MONTH,CURRENT_DATE()) AS Start_Date;

Output: 



2. By using Hardcoded Value

SELECT '2021-05-26' AS Actual_Date,DATE_TRUNC(MONTH,TO_DATE('2021-05-26')) AS Start_Date;


OutPut: 




SQL Server Services

  •  SQL Server supports 4 services
    1. Database Server 
      • SQL Server (DB Engine)
      • SQL Server Agent (Automation)
      • SQL Full-text Filter Daemon Launcher
    2. Report Server
      • SQL Server Reporting Services
    3. Integration Server
      • SQL Server Integration Services
    4. Analysis Server
      • SQL Server Analysis Services

Introduction to SQL Server

  • SQL Server is an RDBMS product, developed by Microsoft
  • With SQL Server
    • We can create and manage databases 
    • It supports BI features (SSIS, SSRS, SSAS)
  • SQL Server is a collection of 4 servers
    • Databases Server
      • To work with databases
      • It works using SQL command
    • Report Server
      • To generate report
      • To implement export and import activities.
    • Analysis Server
      • To build data ware house
  • SQL Server supports a language - SQL (Structured Query Language)
    • IBM product
    • Non procedural language 
    • Common database language used by every RDBMS product
    • Case insensitive language

    • We can say that every server has their own services where database server has 3 main services.
      • SQL Server                (Database Engine)
      • SQL Server Agent     (For automation)
      • SQL Full-text Filter Daemon Launcher
    • For programming SQL Server supports
      • T-SQL          (Transact-SQL)
        • SQL
        • Programming part
      • CLR Integration
        • To execute SP, triggers etc, written with .Net languages
        • We have to enable car FEATURE

        sp_configure 'car enabled',1
        reconfigure

SQL Server Environments

 SQL Server supports 2 types of environments

  1. Stand Alone Environment
    • For small scale applications
    • Only ONE production server
  2. Cluster based Environment
  • For medium to large scale applications
  • Min two production servers
  • Banking, telecom, online application need cluster based environment