 Hey guys, welcome to SSUnitex.com and today we are going to see about the script activity. So what is the script activity? So for using the script activity, you can execute a common operation with dml queries, ddl queries, dml statements are like select update insert, let users retrieve, store, modify, delete, inserting anything that we can do inside the SQL server that we can achieve by using the script activity and here we can also create, alter, or drop the tables and we can modify the existing one or we can also create or update or delete any indexes and users as well. So such type of functionality is available under the SEO data factory on script activity. Next is script activity can be used to verify of purposes. First, we can truncate table or view in preparation of inserting data. Next we can create, alter or drop database objects such as table or view that we have already discussed in previous slide. Then we can recreate the fact and dimension tables before loading the data into them. We can also run the store procedure here. So in the previous videos we have seen about the store procedure activity. So in the store procedure activity, we can only use the store procedure, but in the script task, we can use the store procedure as well as the other database object created or deleted options. Last is the use the row set result set return from a query to the downstream activity. So this option we can also use like we can write any query and we can use that result set in the downstreams. And here are the supported data stores. So first is the Azure SQL Database. Second is the Azure Snaps Analytics. Next is SQL Server Database. Next is Oracle. And last is the Snowflake. So these are the supported data stores. So go to on the browser and we will try to implement this script activity in practical. So here first let me try to understand about the requirement. So inside the SSMS, we are having one of the table that we have created in the previous videos, which is the fail pipeline detail. So this table is there. So in this video, we just want to drop this table in one task and next we just want to create this table. So basically go back to the browser and here let me try to add a new pipeline. So let me call this as script activity. Now here we can search for the script activity. So we can drag and drop the script activity here. And let me call this as drop table. So we just want to drop the table from here. Go back to the settings and here we just need to specify the link service. So we have already created the link service in the previous videos. So I'm going to use the same that is the link service for SSU Proj. Now here we have to specify the script. So under the script we have two options. First is the query and second is the non query. So here we can see this information for the query. So it is saying database statements that written one or more results. Next is the non query. So inside the non query, it will be the database statements that perform catalog operations. For example, querying the structure of the database or the creating database objects such as table or changing that update, insert or delete. So we just want to drop that. So we have to use the non query here and let me try to copy the query that we have already written for dropping the table. So let me try to copy it and here let me paste it. So this will be going to drop the table. Now in the next activity, we just want to create this table which is going to drop here. So we can connect with this and let me call this as create table. Go back to the setting and here again we need to select the link service. Now here we have to specify the query. So we just want to create the table. So let me try to copy this and go back to here and paste it there. So everything looks okay. Let me try to execute it. So first it will be dropping the table and second it will be creating the table. So we can refresh it. So here drop table is completed. Now it is creating the table. So we can refresh. So it is executed successfully. So here we can go and we will try to see the table should be there but table will not have any data. So as we can see it does not have any data but we did not verify whether it is working or not. So how we can verify that? Let me add a weight activity in between. So this weight activity is pausing the pipeline execution for 10 seconds. Now let me try to debug it again. So here it will be going to drop the table and waiting for 10 seconds and after that it will be creating the table. So here drop table is executing now. So it is executed successfully. Now we can go in the SSMS and we will try to see. So table is not there as we can see invalid object name. So it is on weight. So we can refresh it. So weight is completed. So now table is going to create. So once this activity will be completing your table will be inside the SQL server. So we can go and here we can check table is there. So this is what we can do by using the script activity. So thank you so much for watching this video. If you really like this video please subscribe our channel to get many more videos. If you are having any doubt then you can comment your questions in the comment box. See you in the next video.