Convert date to string
Posted in 2007
Topics: Connectivity: ODBC / JDBC / .NET, Data Types & Schema Design
I have this very simple query: SELECT * FROM OPENROWSET('MSDASQL','DSN=DSN;Uid=Uid;Pwd=PWD;',' SELECT DUE_DT FROM ii.PLSEL_NF') When I run it I get the following error: Error converting data type DBTYPE_DBDATE to datetime. The error occurs at the row where DUE_DT is not defined (is empty); since that is a valid business condition, I can't simply query all rows that have a date specified. I guess what I would like to do is to convert the date to a string before selecting from unidata, but I can't figure out how to accomplish that. Just a note - the query works fine if I use a non-date column in my select. Any help as to how to conver this data would be appreciated. Thanks
On Feb 7, 3:59 pm, "mkarb...@gmail.com" <mkarb...@gmail.com> wrote: > I have this very simple query: > > SELECT > * > FROM > OPENROWSET('MSDASQL','DSN=DSN;Uid=Uid;Pwd=PWD;',' SELECT DUE_DT FROM > ii.PLSEL_NF') > > When I run it I get the following error: > Error converting data type DBTYPE_DBDATE to datetime. > > The error occurs at the row where DUE_DT is not defined (is empty); > since that is a valid business condition, I can't simply query all > rows that have a date specified. I guess what I would like to do is > to convert the date to a string before selecting from unidata, but I > can't figure out how to accomplish that. > > Just a note - the query works fine if I use a non-date column in my > select. > > Any help as to how to conver this data would be appreciated. > > Thanks I guess I should've specified - the database I'm querying in openrowset is a Unidata via a IBM Unidata ODBC driver; the query is run from within sql server 2005
mkarbarz@gmail.com wrote: > On Feb 7, 3:59 pm, "mkarb...@gmail.com" <mkarb...@gmail.com> wrote: > >>I have this very simple query: <SNIP> > > I guess I should've specified - the database I'm querying in > openrowset is a Unidata via a IBM Unidata ODBC driver; the query is > run from within sql server 2005 Post to the UNIDATA newsgroup, there are few here who use that product. Art S. Kagel