Hello,
I have a file which i upload into an SQL database using Alteryx. I want to make sure the input file (which is usually in excel) has not changed some of the fields into a different type (string, bool double) to what sql is expecting. I want to use a test tool to flag an error if it identifies the input field is a different type. Basically i need to make sure the input has the same field types as the SQL table so it doesn't reject it. Not sure how to do this so would appreciate some help!
Solved! Go to Solution.
Hi @Sammy22
If your goal is to convert column datatype to an expected data type you can use select tool to set or force datatype as required.
Hi @Sammy22 ,
You can use the "Field Info" tool to get types for all your fields as data then use it to check if they are good !
Hi @Sammy22
If you want to get notified whenever the datatype has got changed you can use block like below to throw an error message.
Workflow:
1. You need to have a lookup table with predefined field names and its datatype used.
2. Using field info get field names and data type of current input file.
3. Using join tool we will look into the left unjoin to identify is there any changes.
4. Using a message if there is any new fields (i,e row number from left un-join > 0) then it triggers an error message. If datatype are matched left unjoin will be 0 (i,e row number = 0) so no error message will be triggered.
Hope this helps : )