Help on mssql query service
I have a ms sql table called "site". to keep the question simply, say the table contains one identity column called site_id (primary key), and another column called site_name. when a record is inserted, the site_id automatically increases. I need to get the returned new site_id and then do an insert using the site_id into a few other tables in a single action. I tried to create 3 services, one is sql command using insert statement. the second one is a sql query with return type as infotable and sql statement is "select @@IDENTITY as 'Identity'"; the third service is a localscript with return type as number looks like following:
var params = {
site_name: 'abc' /* STRING */
};
// result: NUMBER
me.InsertSiteTable(params);
// result: INFOTABLE dataShape: "ProfileIdentityData"
var result = me.SelectIdentity();
however, I got the result of 1, but the actual ID is 1012. I think the reason is in order to get the new site_id value, the insert and select should be in one session. but I am not sure how to construct it in Thingworx. can you help?
Thanks,
-LuWen

