Converting Yes/No and datetime fields

Converting Yes/No and datetime fields

Post by Earl » Sat, 07 Jun 2003 01:58:07



I'm creating a table structure in a handheld device to synch with a
server-based installation. Alas, the field types are not totally compatible.

I'm moving Telemagic data into SQLCE.

In particular, TM uses Yes/No as a data type but SQLCE does not. I can
convert to a nchar(3), but is this really what I want to do?

On the other hand, SQLCE allows me to use a "datetime" field, as does TM,
but the TM output is not in the same format as the SQLCE. Anyone know of an
interim solution to this? Thanks.

 
 
 

1. Converting a Datetime field to Month/Yr format

Problem:
One of my fields that I am trying to group upon in a view is a datetime
field where the records are stored with weekly information.
I need to group by Month/Yr.
I can get this field into a month/year format using:

CONVERT (varchar(2), DATEPART(ww, weekly_date)) + '/' + CONVERT
(varchar(4), DATEPART(yy, weekly_date))

But this returns a varchar data type so I cannot filter against this
evaluated column using an expression such as:

<= DATEADD(month, 12, GetDate())

because the filter criteria and the evaluated column are of different
data types.

Question:
How can I aggregate against the Month & Yr of data organized with weekly
records?
The Format function isn't supported in TransactSQL.  I am looking to
format the weekly date into a datetime common to the Month & Yr of the
record.  If all records of common Month & Yr where formated to all be
mm/01/yyyy, (first of the month), that would be fine.

Thanks for your help.

David K Hambright

2. JDBC driver for Oracle 8i (8.0.5) under Linx

3. convert varchar field to datetime Question

4. SQL STring

5. Converting datetime fields to GMT

6. argh... can't cast varchar to int

7. Converting problem From String to Datetime field

8. Restructuring a table through program code

9. Converting datetime field to military time

10. converting datetime to unix datetime

11. Converting a VB.NET DateTime to SQL DateTime

12. Coverting Long to String and converting unix datetime in it to regular datetime

13. Help - Access yes/no fields upsized to SQL Server SQL_BIT fields