23 Foreach loop ado enumerator in SSIS example

  Рет қаралды 47,863

Learn SSIS

Learn SSIS

Күн бұрын

Пікірлер
@michaelmuell
@michaelmuell Жыл бұрын
Your Channel is an absolute goldmine. Thanks a lot!
@learnssis
@learnssis Жыл бұрын
Thank you so much Michael Muell.
@SaraNeiman
@SaraNeiman 8 ай бұрын
Amazing course, exactly what I need, thank you so much for creating it
@learnssis
@learnssis 8 ай бұрын
Thank you Sara.
@AshishPatel-yl1bk
@AshishPatel-yl1bk Жыл бұрын
How to run same SQL script across different SQL servers using Each Loop ?
@learnssis
@learnssis Жыл бұрын
In the first execute SQL task you can write a query to get list of all servers assign it to an object variable. Now you will use the foreach loop container as shown in the video and will select the ado enumerator, will select the object variable, and will need to create an SSIS variable like ServerName whose value you can set in the foreach loop in the Variable mapping pane. Now in the oledb connection manager, you can go to expression and set the ServerName property from the ServerName ssis variable.
@ritujavyavahare7328
@ritujavyavahare7328 3 күн бұрын
I think there is no need to create filepath variable, because we are not using it anywhere. I tried this without filepath var and it worked fine.
@learnssis
@learnssis 2 күн бұрын
Yes you are right.
@wil-fri
@wil-fri Жыл бұрын
You are a hero ❤🎉
@learnssis
@learnssis Жыл бұрын
ha ha 😀.
@javaguitarist
@javaguitarist 2 жыл бұрын
Thank you so much. This helped me enormously.
@learnssis
@learnssis 2 жыл бұрын
You are most welcome Scott.
@khbeyonce
@khbeyonce 3 жыл бұрын
Aqil bhai, just a quick question why did we create FilePath variable as I don't see we used it anywhere
@learnssis
@learnssis 3 жыл бұрын
You are correct. I created a FilePath variable but did not use it, good catch. We don't need to create the variable if we are not using it. Thank you.
@SuccessPradhan-h2n
@SuccessPradhan-h2n Жыл бұрын
Hey there, I have a question regarding my database setup. I have a table(Directory), there are few columns that store error flags, using "ERROR" or "OK" to indicate errors. I also have another table that stores the names of columns with error flags. I'm wondering if I can use a Foreach Loop to dynamically retrieve these column names and generate an Excel file for each column where the data is "ERROR." In my Execute SQL Statement, I'm currently using the command: select distinct ERROR from Error_Name; Where "ERROR" is the column name and "Error_Name" is the table storing all the columns with error flags. Within the Foreach Loop, I'm configuring the data flow in the OLE DB Source Editor, and for the Data Access Mode, I'm using SQL Command Text with the following query: select * from Directory where ? like '%ERROR%'; My question is whether this setup is appropriate for achieving my goal of dynamically generating Excel files for columns with "ERROR" data. Will the SQL Command inside the data access mode recognize the '?' parameter? I want to ensure that it properly substitutes the parameter with the column names when executed. Any advice or suggestions would be greatly appreciated!
@learnssis
@learnssis Жыл бұрын
Are you able to generate the excel file or are you getting any error ? If you are able to generate the excel file then I don't think there is any issue with this approach.
@SuccessPradhan-h2n
@SuccessPradhan-h2n Жыл бұрын
@@learnssis I have successfully executed the loop, but I am not receiving any data. The loop executed without errors, but I suspect there may be an issue with the SQL command. It seems that we cannot assign a column name as a parameter directly. Is there an alternative approach, such as using a script task?
@MVinodKumar-tt1tu
@MVinodKumar-tt1tu Жыл бұрын
Hello Sir, When I used Objcity variable datatype as String i got this error " [Execute SQL Task] Error: Executing the query "SELECT DISTINCT CITY FROM PERSON.ADDRESS" failed with the following error: "The type of the value (DBNull) being assigned to variable "User::ObjCity" differs from the current variable type (String). Variables may not change type during execution. Variable types are strict, except for variables of type Object. ". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly. " As we know we got this error because I need to use Object as datatype bcz we are getting more than single row. But i didnt understood what is this error sir? Please Explain sir
@learnssis
@learnssis Жыл бұрын
Objcity variable datatype should be used as Object not string.
@antoniolupen6138
@antoniolupen6138 11 ай бұрын
Simply amazing. Thaaanks
@learnssis
@learnssis 11 ай бұрын
You are most welcome Sir.
@govindasindhu3728
@govindasindhu3728 11 ай бұрын
When we want our result set as single row in execute SQL task such that it must iterate through each value then what to use in ado object source variable .? User:objcontractid I used but it is throwing error can you please suggest the changes
@govindasindhu3728
@govindasindhu3728 11 ай бұрын
Can you please suggest me some video on how to know the difference when to use what type of result set single row, full result set ,etc and then what to use in ado object source variable
@khaledmahmoud8803
@khaledmahmoud8803 5 жыл бұрын
please in need the same example using excel becuse i have issue in connection string The connection string format is not valid. It must consist of one or more components of the form X=Y, separated by semicolons. This error occurs when a connection string with zero components is set on database connection manager.
@parvanekhemati1015
@parvanekhemati1015 Жыл бұрын
Hi please tell me where is the connection manager window, I can't create an Expression
@learnssis
@learnssis Жыл бұрын
If you right click on connection manager and go to properties, you will find the option to write the expressions.
@satishchoudhury1996
@satishchoudhury1996 2 жыл бұрын
I want to extract data for 2 years.. but monthly wise extract i.e 24 files need to be generated automatically based on date How to loop this condition
@learnssis
@learnssis 2 жыл бұрын
I think you can use an execute sql task and in that task just create a staging table and insert 24 months value to that table. For example for 2021 and 2022, insert the values like this 202101, 202102 and so on till 202212. OR you can create 2 columns one for year and one for month and insert the value 2021 for year and 01 for month. Now just before the foreach loop container in the execute sql task select those 24 records Year and month from the staging table and assign the value to Object variable. Now declare 2 more SSIS variable Year and Month and map those 2 variables inside foreach loop container with ado enumerator and then fetch the data from source table using a sql query command and pass the value of these variables year and month to sql query so that sql query value will change for all 24 months during iteration of loop.
@satishchoudhury1996
@satishchoudhury1996 2 жыл бұрын
@@learnssis will definitely give a try.... Thanks
@learnssis
@learnssis 2 жыл бұрын
@@satishchoudhury1996 great.
@deepikarawat1005
@deepikarawat1005 2 жыл бұрын
Sir, Thanks for your Videos... Really Helpful... :)
@learnssis
@learnssis 2 жыл бұрын
Thank you Deepika, glad you liked the videos.
@dilipkumar-ck1nc
@dilipkumar-ck1nc 2 жыл бұрын
In expression builder what u write is not visible can u make a note in notepad
@learnssis
@learnssis 2 жыл бұрын
Okay, I have uploaded a new file and put the expression code there.
@kavithagunashekar5200
@kavithagunashekar5200 3 жыл бұрын
Thank you for the video, it really helped my problem :)
@learnssis
@learnssis 3 жыл бұрын
Glad to know Kavitha that it helped you.
@motoray1973
@motoray1973 6 жыл бұрын
Thanks for this video...just helped me solve a problem I was struggling with.
@learnssis
@learnssis 6 жыл бұрын
Good to know that it helped you. Thanks.
@jorgemontecinosmeza
@jorgemontecinosmeza 3 жыл бұрын
Thit is excelent. Thanks.
@learnssis
@learnssis 3 жыл бұрын
Glad you liked the video. Thanks.
@jhenai1mmmmmh
@jhenai1mmmmmh 2 жыл бұрын
did u know that u save lives? O.o
@learnssis
@learnssis 2 жыл бұрын
ha ha. Thank you Jhenai Dixon.
@kevinalexismartinezherrera7004
@kevinalexismartinezherrera7004 Жыл бұрын
I agree you hahaha
@vinayprasad2144
@vinayprasad2144 5 жыл бұрын
Good video, got a question, in sql task properties when you are setting up resultset, you put 0 for the result name, can you please explain that briefly
@learnssis
@learnssis 5 жыл бұрын
If you are assigning some value to an SSIS variable under resultset, the result name will be assigned in sequential order. The first variable will be assigned result name as 0. If you are assigning values to multiple SSIS variables then second SSIS variable's result name will be 1, and for third one it will be 2 and so on. We assign the result name in sequential order starting from 0.
@vinayprasad2144
@vinayprasad2144 5 жыл бұрын
@@learnssis thanks for explanation
@Shankar-zi3yk
@Shankar-zi3yk Жыл бұрын
why u have taken newyork has cityvariable value because u know the value is present if u dont know how will u go for that value u should explained that wright please make a video on for and for each loop containers in detail each and every point
@learnssis
@learnssis Жыл бұрын
You don't need to give the City variable value to New York, you can keep this empty as well. You can give the value as Delhi or Mumbai as well, I just gave the value as New York because the variable name is City but the value of City will be assigned during for each loop iteration, so don't worry about its value.
@Shankar-zi3yk
@Shankar-zi3yk Жыл бұрын
u have used a filepath variable and u havent used it why confusing us
@learnssis
@learnssis Жыл бұрын
I am sorry for that, Initially I declared the variable FilePath because I thought I will use that in flat file connection manager to make the path dynamic, but during writing the code, a new idea came into my mind that we can write the code without using the FilePath variable thus I did not used it.
@learner_SSIS
@learner_SSIS 2 жыл бұрын
Hi sir,i follow same video in odbc MySQL ( MySQL workbench. And Hiedisql) not working Very easy to work OLEDB side,but ODBC very difficult sir Please upload ODBC video sir
24 Foreach loop Item Enumerator in SSIS Example
7:50
Learn SSIS
Рет қаралды 16 М.
22 Foreach Loop Container in SSIS Example
11:56
Learn SSIS
Рет қаралды 86 М.
Try this prank with your friends 😂 @karina-kola
00:18
Andrey Grechka
Рет қаралды 9 МЛН
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 120 МЛН
21 For loop Container in SSIS
13:28
Learn SSIS
Рет қаралды 71 М.
59 Breakpoints in SSIS | how to use breakpoints in ssis
20:13
Learn SSIS
Рет қаралды 15 М.
The Dome Paradox: A Loophole in Newton's Laws
22:59
Up and Atom
Рет қаралды 763 М.
17 Zip and UnZip files in SSIS
6:39
Learn SSIS
Рет қаралды 34 М.
58 Load Multiple Excel Sheets with different schema
16:41
Learn SSIS
Рет қаралды 16 М.
49 Pass value from Parent Package to Child Package in SSIS
6:54
43 Error handling in SSIS | How to handle errors in SSIS
16:34
Learn SSIS
Рет қаралды 24 М.
Try this prank with your friends 😂 @karina-kola
00:18
Andrey Grechka
Рет қаралды 9 МЛН