I am trying to in rows on the trustee_attr table. To do this, I need to insert values the sid, atrr_name, and attr_val. I used a SQL Query to pull the sid from the trustee table. I am trying to insert that sid for the new row on the trustee_attr table. The error I receive is a conversion data type error. Is there way to resolve this problem or a better method?
Question
Question
Answer
How about just looking it up on the fly so SQL deals with it and you don't have to worry about conversion (which would also get rid of the "SQL Lookup SID" activity, so you'd only be making one connection and call to SQL)?
insert into trustee_attr(sid,attr_name,attr_val) select sid, @attr_name,@attr_val from trustee where trustee_name = @trustee_name
Replies
You'll want to use a custom query instead of an insert so you can add in the convert language.
insert into #test
SELECT 1, 2, convert(varbinary, 'abcdefg')
Are you doing an automated user setup with workflow instead of the SDK?
I am trying to get syntax right Carl, but can't quite get it. Could you give me some more input how I may be able to write this correctly? The insert statement is working, but the sid saved to the database is not correct.
As for the automated user set up, yes that is what we are doing. We have a this data saved on an entry on a Laserfiche 8 server. I would like to move the metadata stored for each user from the template to attributes for the user automatically rather than copy and pasting manually. We have over 500 users we are moving to our Laserfiche 9 server. A SDK may be a better solution, but we do not have the in-house programmer to help us write a SDK. I am attempting to use workflow to help me complete the objective using token values from the template fields an write the data to the trustee_attr table for each user automatically.
What do the values you have look like? If it's the string format for a SID (like "S-1-5-20"), you can't just cast it. You need to call a conversion function like this.