Televantage/SQL's Explicit Data Conversion
My current employer gives consultancies in Computer Telephony (CT) applications, and I have experienced working with couple of hardware and software vendors of this field.
At one site, Artisoft’s Televantage Call Centre is running. Today they reported that all of a sudden, Televantage Clients (The software at agent station) started giving Unknown Database error while logging on.
After googling I came to know that in case MDAC is configured wrongly or files are overwritten with some old version, such problem may occur, I tried Televantage (TV) client on different machines, and even on server that was properly locked down and no one had changed any thing in it for long, but all these failed.
As problem was related to Database, after Profiling I came to know that two stored procedures are called when client tries to login, sp_verifyLogin and sp_verifyStationLogon, I tried running these manually from the Query Analyzer, and both failed with some integer overflow errors. I retrieved their SQL and tried running those SQLs manually to track the problematic SQL part. Both of them were related with Address table, that has Address field of type nvarchar field that was being compared with StationID parameters of these two procedures. The StationID parameter is integer, and SQL server was using implicit conversion.
The nvarchar field in the queries was on left side and the integer parameter was on the right side, and left hand values were tried to convert to integer giving overflow errors. Does the position of variables in the comparison matter? (I have no idea right now) Anyways I modified the queries and used explicit data type conversion of the integer to nvarchar using cast TSQL function. The problem went away J
By the way, if anyone needs any assistance/consultancy regarding Computer Telephony, especially with Dialogic (Intel company) telephony cards, feel free to contact me!