S
Smitty-Werben-Jager-Manjenson
Guest
I am using an ODBC driver to connect to a Progress database via a Windows C# application. The problem I am having is my data is being truncated.
SELECT
CASE
WHEN (table1_qty_comp = 0) THEN 'Pending'
ELSE
CASE WHEN (table1_qty_comp >= table2_qty_req) THEN 'Completed'
ELSE 'In-Process'
END
END AS 'Status'
FROM
table1 LEFT JOIN table2 ON table1_part = table2_part
Only 8 characters will appear in my 'Status' column so 'In-Process' turns into 'In-Proce'.
I've tried various casts/converts such as
cast('In-Process' as varchar)
cast('In-Process' as varchar(12))
cast('In-Process' as nvarchar)
cast('In-Process' as nvarchar(12))
convert(varchar(12), 'In-Process')
convert(nvarchar(12), 'In-Process')
str('In-Process')
to no avail. How can I get the full 'In-Process' to appear in my column?
Here is how I query the Progress database from C#
DataTable dt = new DataTable();
try
{
using (OdbcConnection conn = new OdbcConnection(GetConnectionString(db)))
{
OdbcCommand cmd = new OdbcCommand(qry, conn);
conn.Open();
OdbcDataAdapter adpt = new OdbcDataAdapter(cmd);
adpt.Fill(dt);
}
}
catch (OdbcException e)
{
}
return dt;
Update
I wanted to append my question with what may be useful information... This is ODBC driver: Vendor=DataDirect, Progress SQL92 v9.1E, version 4.10.01. Here are some resources for this particular driver provided by another user in the comments, here and here Also, I was able to solve my issue by not using nested CASE statements like:
SELECT
CASE
WHEN (table1_qty_comp = 0) THEN 'Pending'
WHEN (table1_qty_comp >= table2_qty_req) THEN 'Completed'
ELSE 'In-Process'
END AS 'Status'
FROM
table1 LEFT JOIN table2 ON table1_part = table2_part
Continue reading...
SELECT
CASE
WHEN (table1_qty_comp = 0) THEN 'Pending'
ELSE
CASE WHEN (table1_qty_comp >= table2_qty_req) THEN 'Completed'
ELSE 'In-Process'
END
END AS 'Status'
FROM
table1 LEFT JOIN table2 ON table1_part = table2_part
Only 8 characters will appear in my 'Status' column so 'In-Process' turns into 'In-Proce'.
I've tried various casts/converts such as
cast('In-Process' as varchar)
cast('In-Process' as varchar(12))
cast('In-Process' as nvarchar)
cast('In-Process' as nvarchar(12))
convert(varchar(12), 'In-Process')
convert(nvarchar(12), 'In-Process')
str('In-Process')
to no avail. How can I get the full 'In-Process' to appear in my column?
Here is how I query the Progress database from C#
DataTable dt = new DataTable();
try
{
using (OdbcConnection conn = new OdbcConnection(GetConnectionString(db)))
{
OdbcCommand cmd = new OdbcCommand(qry, conn);
conn.Open();
OdbcDataAdapter adpt = new OdbcDataAdapter(cmd);
adpt.Fill(dt);
}
}
catch (OdbcException e)
{
}
return dt;
Update
I wanted to append my question with what may be useful information... This is ODBC driver: Vendor=DataDirect, Progress SQL92 v9.1E, version 4.10.01. Here are some resources for this particular driver provided by another user in the comments, here and here Also, I was able to solve my issue by not using nested CASE statements like:
SELECT
CASE
WHEN (table1_qty_comp = 0) THEN 'Pending'
WHEN (table1_qty_comp >= table2_qty_req) THEN 'Completed'
ELSE 'In-Process'
END AS 'Status'
FROM
table1 LEFT JOIN table2 ON table1_part = table2_part
Continue reading...