Headder AdSence

IICS

 https://knowledge.informatica.com/s/article/624339?language=en_US

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

What is Control Flow?



    Control Flow is the default work space or SSIS Designer part when we create a package in SSIS (.dtsx), which will control the flow of Containers, and Tasks, optionally we can control the flow by using Precedence constraint for these Containers / Tasks.

For Complete Information Go Here

What are the components in SSIS?



2. Data Flow
3. Parameters
4. Event Handlers
5. Package Explorer 

What is SSIS?




     SSIS is know as SQL Server Integration Services which is a Microsoft Tool, which will use for Extract, Transform and Load the data from the various sources.

Parallel Execution in SSIS

Parallel Execution: is nothing but number of tasks to be executed simultaneously

     This simultaneously would be happen when there is no relation between two task with precedence constraint then only the tasks will start altogether.

    But here is limit of task executions to start altogether in SSIS, the default parallel execution limit is 

The number of processors of our using machine + 2

when you execute the package, by default number of processors of our using machine + 2 tasks will start.

     see the below image when I started directly my package it will start with 6 tasks at a time because my machine has 4 processors.

     I created one package with 20 Execute SQL Tasks without precedence constraint means no dependence between them.

Picture 1: below is the package with 20 Execute SQL Tasks


Picture 2: Started with 6 packages out of 20


Picture 3: Started with next 6 packages after completing the first 6 package out of 20


Picture 4: now again picked next 6 packages after completing previous started 6 packages.


Picture 5: finishing the rest of packages.


here is the way to increase the limit of default parallel execution tasks, Please go here


Please give feedback by your comment bellow.

MaxConcurrentExecutables Property in SSIS Package

MaxConcurrentExecutables: This is a package level property, using this this property we can increase the number of tasks parallel execution process.

    So we can increase the size of the exection taks parallely usig this MaxConcurrentExecutables, for default process please check here how it executes.
 Let see by increaseing the size of this MaxConcurrentExecutables propery how it works

  When i execute without changing any MaxConcurrentExecutables propery, here is the process which I already posted.

    I creaed once package with 20 taks without precedence constraint which means no relation between each task.

Picture 1: A package with 20 tasks without any relation (precedence constraint)



Process to change the property value.

Step 1: Go to Properties window on SSIS package by pressing F4 / directly click on properties window which is right side in SSIS package.


Step 2: Go to MaxConcurrentExecutables property on properties window.


By default SSIS package keeps MaxConcurrentExecutables propery value as -1, which means default number of taks is Total number of processors of machine + 2 task can start exectuion at once.

Step 3: Change default values -1 to 10 / as you required.



     After changing MaxConcurrentExecutables propery from -1 to 10

Picture 2: started package and picked first 10 tasks at a time out of 20 tasks.



Picture 3: started package with next 10 tasks at a time after finishes the previous 10 tasks.



so finally it finishes all the packages with picking the 10 at a time for the process.



and these 10 tasks starting order by name if we observe closely.

here is my observation,by increasing this property value our process will finish very quickly, it is very useful to when we need to save the execution time. 

 but keep in mind when you are increasing the MaxConcurrentExecutables propery value, is there any other application using same processors and do we have enough size these kind of things take into priority. 

Please provide you value feedback by giving your comment below

Ctrl R not working in SQL Server?

Ctrl + R: it's general thing which SQL Developer uses often in day.

     Some times this Result Pane won't work, so we can again create this short cut, please go through below steps.


1. go to Tool > ..Options > Keyboard > Keyboard


2. Select Window.ShowResultsPane under Show Commands containing

3. SQL Query Editor under Use new short cut in:

4. Click empty space of Press Shortcut Keys:then give your Shortcut Key (pres your           
     required shortcut key)

What is Primary Key in SQL Server?


                                                                     PRIMARY KEY                                                                                         

1. It's a CONSTRAINT, a collection of columns uniquely identifies each row in a table

2. Only one PRIMARY KEY constraint allows on Table.

3. PRIMARY KEY column will not allow NULL Values & duplicate values















What is the difference between DELETE and TRUNCATE statements?


                                                           TRUNCATE vs DELETE
















TRUNCATE
DELETE
Truncate is used to delete the all records in table
Delete is used to delete the row level and table level data
We can’t rollback the data
We can rollback data if we maintain the transaction
It’s auto committed
It’s explicit committed
It’s a DDL (Data Definition Language) Command
It’s a DML (Data Manipulation Language) Command
It’s faster than the delete
It’s very slow when we compare with TRUNCATE



Synchronous and Asynchronous Transformations In SSIS

     
          I am going to explain in simple manner about Synchronous and Asynchronous Transformations in SSIS, as we know in SSIS everything based on transformations only, so these divided into few types.

Synchronous and

Asynchronous

         Mostly we should prefer for Synchronous only when we are not able to meet our requirements using Synchronous then only we should go for Asynchronous Transformation.

Synchronous (non-blocking): 
                            Processing the row by row transformation into next task, in detail, one record will not wait /depend on buffer for other record, example Data Conversion Transformation, DCT will not wait / depend on other record to transform to the next task simply it will convert the record and send to the next task, so Output is Synchronous with Input.



Asynchronous(Fully Blocking):

                                  Processing rows will depend on other / next record based on those next record it will take the decision and transform to the next task, Example, Sort Transformation, in this transformation holds the all records on buffer then it will make the decision based on the data then only records will pass to the next task.





More about these Transformation please go through below link(s).



Please give your valuable comments below :)