As this is the "latest" in date topic on this subject, and as it is still relevant, I am bumping this. The problem is not unique to any ASE version, as I have observed from others it happens on ASE 11.x, 15.0, 16.0, and for on 15.7. The problem was caused by an incorrect conversion to bit. All those "convert(bit, & )" were to blame. This is an invalid operation to perform as the result of "100 & 100", is "100", not "1". I have corrected the query under "Db.CommonSql" -> "DescribeTableColumns", and after a reconnecting to the ASE server, I can now see the tables properly. This is the new code: select sc.name as Column_Name, sc.colid as Column_ID, convert(bit,case when (sc.status & 8) = 8 then 1 else 0 end) as Nullable, convert(bit,case when (sc.status & 128) = 128 then 1 else 0 end) as Is_Identity, case when sc.usertype = -1 then sxt.xtname else st.name end as Datatype, case when sc.usertype = 34 then sc.length/2 when sc.usertype = 35 then sc.length/2 else sc.length end AS Datatype_Length, sc.prec as 'Precision', sc.scale as Scale, convert(bit,case when st.name in ('char', 'nchar', 'varchar', 'nvarchar', 'binary', 'varbinary', 'unichar', 'univarchar') then 1 else 0 end) as Variable, convert(bit,case when index_col(db_name() + '.' + user_name(so.uid) + '.' + object_name (si.id),si.indid,1) = sc.name then 1 when index_col(db_name() + '.' + user_name(so.uid) + '.' + object_name (si.id),si.indid,2) = sc.name then 1 when index_col(db_name() + '.' + user_name(so.uid) + '.' + object_name (si.id),si.indid,3) = sc.name then 1 when index_col(db_name() + '.' + user_name(so.uid) + '.' + object_name (si.id),si.indid,4) = sc.name then 1 when index_col(db_name() + '.' + user_name(so.uid) + '.' + object_name (si.id),si.indid,5) = sc.name then 1 when index_col(db_name() + '.' + user_name(so.uid) + '.' + object_name (si.id),si.indid,6) = sc.name then 1 when index_col(db_name() + '.' + user_name(so.uid) + '.' + object_name (si.id),si.indid,7) = sc.name then 1 when index_col(db_name() + '.' + user_name(so.uid) + '.' + object_name (si.id),si.indid,8) = sc.name then 1 when index_col(db_name() + '.' + user_name(so.uid) + '.' + object_name (si.id),si.indid,9) = sc.name then 1 when index_col(db_name() + '.' + user_name(so.uid) + '.' + object_name (si.id),si.indid,10) = sc.name then 1 when index_col(db_name() + '.' + user_name(so.uid) + '.' + object_name (si.id),si.indid,11) = sc.name then 1 when index_col(db_name() + '.' + user_name(so.uid) + '.' + object_name (si.id),si.indid,12) = sc.name then 1 when index_col(db_name() + '.' + user_name(so.uid) + '.' + object_name (si.id),si.indid,13) = sc.name then 1 when index_col(db_name() + '.' + user_name(so.uid) + '.' + object_name (si.id),si.indid,14) = sc.name then 1 when index_col(db_name() + '.' + user_name(so.uid) + '.' + object_name (si.id),si.indid,15) = sc.name then 1 when index_col(db_name() + '.' + user_name(so.uid) + '.' + object_name (si.id),si.indid,16) = sc.name then 1 else 0 end) onPrimaryKey, convert(bit,case when (isnull(sc.status2, 0) & 128) = 128 then 1 else 0 end) as encrypted, convert(bit,case when st.usertype > 100 then 1 else 0 end) as usertype, (select text from syscomments where sc.cdefault = id) as DefaultValue, (select text from syscomments where sc.domain = id and charindex('check', lower(text)) = 1) as CheckConstraint, 0 as DefaultValueType, su.name as EKUser, seo.name as EncryptionKey,sc.encrkeydb,'' as BindValueName,sc.encrkeyid, case when sc.cdefault = 0 then 0 else (select status & 8 from syscomments where sc.cdefault = id) end as ConstraintDefault, isnull(sc.status2, 0) & 131072 as IsCompressed, convert(bit,case when (so.sysstat3 & 4096) = 1 then 1 when (so.sysstat3 & 8192) = 1 then 1 else 0 end) as TableCompression, sc.lobcomp_lvl as LobCompLvl, case when st.type in (34, 35, 174) then case when sc.lobcomp_lvl is null and so.lobcomp_lvl is null then 'default' when sc.lobcomp_lvl is null and (so.lobcomp_lvl = 0) then 'Not compressed' when sc.lobcomp_lvl is null and (so.lobcomp_lvl <> 0) then convert(varchar, so.lobcomp_lvl) + ' (inherited from table)' when (sc.lobcomp_lvl = 255) then 'Not compressed' else convert(varchar, sc.lobcomp_lvl) end else 'N/A' end as DetailLobLvl, case when st.type in (34, 35, 174) then convert(bit, 1) else convert(bit, 0) end as IsLOB from syscolumns sc, sysobjects so, systypes st, sysxtypes sxt, sysindexes si, sysobjects seo, sysusers su where sc.id = so.id and sc.usertype = st.usertype and so.name = {{StringQuote(?)}} and so.uid = user_id({{StringQuote(?)}}) and so.id *= si.id and sc.xtype *= sxt.xtid and si.indid > 0 and convert(bit, si.status & 2048) = 1 and sc.encrkeyid *= seo.id and seo.uid *= su.uid order by sc.colid Enjoy, Ziv.
↧