dbTalk Databases Forums  

Converting separate foxpro date and time fields to datetime thru DTS

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Converting separate foxpro date and time fields to datetime thru DTS in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Andrew Grandison
 
Posts: n/a

Default Converting separate foxpro date and time fields to datetime thru DTS - 08-05-2004 , 04:04 AM






Hi,

I am trying to work out how to script (as part of a transform data
task) the conversion of a date field and a time field (a char(5) field
with, for example, "14:30") from a foxpro 2.6 table and combine them
to form a datetime field for the DTS destination field.

Maybe even some indication of the VBScript functions I should look at
using.

I have no VBScript experience.

Any help appreciated.
Thankyou,
Andrew

Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Converting separate foxpro date and time fields to datetime thru DTS - 08-07-2004 , 03:23 AM






OK So for the date that's easy

You can parse the value you get in and make it into a format SQL Server
understands

One example would be to use this

Formatting Character Data into Datetime fields
(http://www.sqldts.com/default.aspx?249)


SQL Server likes certain formats and will never misinterpret them so if you
can arrange your source to look like that then you are cooking.

Example

DECLARE @d char(10)
DECLARE @t char(5)


SET @d = '20/12/2004'
SET @t = '12:09'

select CAST(@d + ' ' + @t as datetime)

You do not offer examples of what your dates look like so I cannot offer a
real example. Have you tried anything?

--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.konesans.com - Consultancy from the people who know


"Andrew Grandison" <andrewgrandison (AT) hotmail (DOT) com> wrote

Quote:
Hi,

I am trying to work out how to script (as part of a transform data
task) the conversion of a date field and a time field (a char(5) field
with, for example, "14:30") from a foxpro 2.6 table and combine them
to form a datetime field for the DTS destination field.

Maybe even some indication of the VBScript functions I should look at
using.

I have no VBScript experience.

Any help appreciated.
Thankyou,
Andrew



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.