Does anybody know how to read the content of Interaction table, AllAttributes column (image type) in Genesys UCS main database on Microsoft SQL server 2008?
We do not want to change any data - just read it! We need to look into that column via SQL code.
I do not know why do you have posted this topic here, because it is not problem/issue related to Genesys platform, but to the MSSQL in general. So,on google you can find a lot of answers and way how to achieve it. Why do you need read the column via database? You can check it currently:
catanirex, i’ve tried, but without success. looks like standard solutions for decoding blob data doesn’t work with ucs db. don’t waste time with it. better way that i found is using Contact SDK for requesting interactions and their content.
We also tried standard SQL commands without success for that column. IxnContent table we managed to view using standard conver methods - but not the AllAttributes.
We really would need to read it, since developing a sdk application is a bit to much work just for this
cavagnaro & Kubig - I know the ucs db structure since long time. But Genesys have done something non-SQL standard in the AllAttributes Image/blob column Thats why I posted the question here.
I do not about some non-standard using. In SQL world is image type using for example saving of string field. Whole procedure how to read image type column from SQL database took me approx 5 minutes. What did you do for solution?
You can just read the column’s value and encode it from bytes to the string (how simple) - There are many ways how to achieve it and is at your decision what solution you will choose.
it depends of your location
i really spent a huge time trying to extract data from this field. and i know it was possible in case of ucs 7.6 and ms sql 2005. don’t know what is changed, but can’t do this in latest version.
I have tried it on UCS 8.1.2 and MSSQL2008. So, you are not right, unfortunately. Simple test, copy the value from the column and put in into some on-line converter from hex to string, check yourself what will be the result
Not yet,but on web are Some hints for creating procedure. Other Option Is via Some application which can Connect to The database and convert The bytes to The String. I have not time to develope working code for sql, I just want to correct information about unreadable column,because it is not true. For explain, I hate the words “it is not possible” or something else. Other thing is Genesys must be able to read this column,so the data MUST be readable via std function.
It should be the one of the ways, but I think that Genesys read the value in byte format and then convert it in own code(stack). If anybody have time to test/try trace via SQL profiler, it will be interesting for others here
You can decode it using the following, example, ruby script:
data = event['InteractionAllAttributes'];
# Filepointer - could be two bytes and two bytes for number of segments, not sure
sizeBytes = 3;
fp = 0;
# 16 bit big endian
length = data[fp, sizeBytes].unpack('n')[0];
segmentCountBytes = 1;
fp += sizeBytes;
segmentCount = data[fp, segmentCountBytes].unpack('C')[0];
# Skip 0x00, not sure about this - could be it is 16 bit int
fp += 1;
segmentSizeBytes = 2;
segmentIdx = 0;
event['InteractionAttributes'] = {};
while (fp < length)
# Skip 0x00 - todo, is part of header?
fp += 1;
# Key - Value structure
segmentLength = data[fp, segmentSizeBytes].unpack('n')[0];
fp += segmentSizeBytes;
key = data[fp, segmentLength];
fp += segmentLength;
segmentLength = data[fp, segmentSizeBytes].unpack('n')[0];
fp += segmentSizeBytes;
# Show non readable characters as .
value = data[fp, segmentLength].gsub(/[^[:print:]]/,'.');
fp += segmentLength;
event['InteractionAttributes'][key] = value.to_s;
end;