Forum Home › Forums › Understanding the Software › Using KpDBImport and SQL
Tagged: KpDBImport, SQL
- This topic has 6 replies, 3 voices, and was last updated 1 year, 4 months ago by gabeirinhas.
-
AuthorPosts
-
January 20, 2022 at 6:43 am #9951Hennie_KotzeParticipant
Good Day,
I can successfully connect to my SQL database and retrieve the latest data from a DB. I just have some general questions about the functionality and capabilities of this driver:
1. I have to assign each column in my SQL DB to an input channel. If I query correctly, then I will always read the latest variable from the table into my channel. Is there any way that I can read the whole table from SQL? Say I want to query ” SELECT TOP (10) “… Is it not possible to display the top 10 entries?
2. I have a primary key in my DB called “Date_Time_String” and it is nchar(50). The format is entered yyyy-mm-dd hh:mm:ss. This format seems to be too long for my input channel to display. My input channel only displays yyy-mm-d and then the string ends. It seems like I can only read (8) characters from the source. (The input channel type is configured as “REAL”). Is there any workaround for this?
Regards,
January 20, 2022 at 6:49 am #9952MikhailModeratorHello,
1. The DB Import driver reads only 1st row. You may write a stored procedure to convert to 10 entries into 1 row.
2. Right, max. string length of input channel is 8 chars. In SQL request you should convert it to Unix time (integer seconds) and then use in Rapid SCADA. The details we could discuss on the forum.
January 20, 2022 at 8:53 am #9962Hennie_KotzeParticipantMikhail,
Thank You for the response.
Let me test it and I’ll revert back to you if I struggle.
Regards,
December 9, 2022 at 12:01 pm #11743gabeirinhasParticipantHello,
I have questions about dbimport,
1. How could I do to communicate a sqlite database with the rapid scada environment. I have been trying without success.
2. When I communicate with a sql server database,
in “data retrieval”, I ask for the following fields as an example.SELECT value FROM tags WHERE name = ‘LT1’ ORDER BY stamp DESC
SELECT value FROM tags WHERE name = ‘PT1’ ORDER BY stamp DESC
However, I only get in tags data, the first data. How can I get both data.
Thanks in advance, greetings
December 10, 2022 at 6:58 am #11744Hennie_KotzeParticipantGabeirinhas,
If you look at the attached pictures you will see an example of how I did it.
Hope it helps…
Regards,
December 10, 2022 at 10:15 am #11746Hennie_KotzeParticipantDecember 10, 2022 at 8:10 pm #11747gabeirinhasParticipantHello,
Thank you, it has helped me
To be able to dump the values as I need them,
I must create a new table, where each of the columns corresponds to the value that I want to show,
Thanks for your help,
greetings
-
AuthorPosts
- You must be logged in to reply to this topic.