RSSQL = FactorySQL

I have been trying for days to get RSSQL to READ data out of MSSQL 8.0 with no luck. I am in the process of downloading FactorySQL and am going to try to install this and get this to work. What I have is a entire SCADA system of wells and water towers all have there current information into MSSQL - I need to get that data out of MSSQL and into a CLX processor so I can control pumps and such.

So how easy is it to get data out of a table in MSSQL with factorySQL?
Because I think the problem I was having with RSSQL is I can only read data out of a Stored Procedure where, all the information is in the Tables.

Right now I just need to READ info out of the database. Later on I will have to right info into the database from the processor.

Thanks for any tips.

So right now you are just trying to read data from a Microsoft SQL Server database? You’re not yet trying to read to or write from PLCs?

In that case, FactoryPMI would be your better tool. Both typically install with the unified installer. You would set up your database connection in the gateway configuration web page. From there create a project. You can make your screens however you want - labels telling you about the process in realtime, tables of data, images changing colors, etc.

FactorySQL is a bi-directional databridge between the PLC and SQL database. With SQLTags, you may not even need to use FactorySQL directly (except for logging data and other operations).

How is your database layed out (describe the schema)?

I currently have RSVIEW as my HMI. So I am trying to read out of the database and put the information into the PLC then from there RSVIEW will display the information.

I am not sure on how to map the information in the table to an OPC item in the PLC. I have everything setup I can see the database inside of FactorySQL - I have the Direction setup for the group to go from DB-OPC. I am not sure on what I have to put in the WHERE column.

thanks for your time


Ok, so it sounds like you’re almost there. From your original post, it sounds like FSQL will be a perfect fit. Here’s what you need to do:

  1. Map your OPC items to the right FIELD names. That is, say you want your control logix tag name “tank_level” to point to a column in your db called “tlvl”. When you brought that tag down into a group (by browsing, dragging, and dropping), it created an OPC item called “tank_level”. That name is the default column name it’s going to use. By double clicking the item, or simply hitting ENTER, you would change it to “tlvl”. Now it will be mapped to that field.

  2. You’ve set your table name, so now you have the table and the column to look at. The final step is which ROW to go to. A standard group will look at one row at a time- and the settings are FIRST, LAST or CUSTOM, where you would put in your where clause.
    The trick now it to figure out how to identify the row. Most tables will have what’s known as a “primary key”. This is one (or more) columns who value will be unique for every row. For example, on every table that FactorySQL creates, there’s a column call tablename_ndx, which is an auto incrementing number.
    Say you have a column called “tank_number”, and a row for every tank. You’ve created a group, added that item above, and want to tie it to tank number 4. Your where clause would then be “tank_number=4”, without the quotes.

There’s one other thing to note: FactorySQL expects each table to have a primary key, and by default it expects it to be a certain name. To change this to accomidate an existing table, click “Options” on the action tab, right above “Table Name”, and select the correct key.

Hope this helps, welcome to the forum, and please feel free to post with any other questions!