Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
| Search | Today's Posts | Mark Forums Read
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old September 29th, 2003, 05:53 AM
Registered User
 
Join Date: Aug 2003
Location: Stafford, , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default DTS Import ( Date string to Date field)

Dear All

I am trying to import data from a text file into a SQL database. I have a date field in the source file in the format YYYYMMDD and the corresponding column in the destination SQL database is a date format.

In trying to do a straight DTS copy from source to destination, I encountered the following error. “ data type from source different ( string) from data type in destination (Date)”.

I understand that I would have to write an ActiveX/VB Script to do the conversion from string in data source to date format in the destination source. My knowledge in this area is almost zero. I would be grateful if anybody could tell me how to go about this.

Thanks
George
  #2 (permalink)  
Old September 30th, 2003, 06:28 AM
Authorized User
 
Join Date: May 2003
Location: Delhi, Delhi, India.
Posts: 62
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi
Try to use Format function
Format(yourString,format of date in your table)
eg.
datestring="20030930"
fieldname=format(datestring,"MM/DD/YY")

Bye.


Quote:
quote:Originally posted by gfowajuh
 Dear All

I am trying to import data from a text file into a SQL database. I have a date field in the source file in the format YYYYMMDD and the corresponding column in the destination SQL database is a date format.

In trying to do a straight DTS copy from source to destination, I encountered the following error. “ data type from source different ( string) from data type in destination (Date)”.



I understand that I would have to write an ActiveX/VB Script to do the conversion from string in data source to date format in the destination source. My knowledge in this area is almost zero. I would be grateful if anybody could tell me how to go about this.

Thanks
George
Deepesh Jain
VB,VBA & .NET Specialist
Wiley Support Team


Similar Threads
Thread Thread Starter Forum Replies Last Post
Updating a Date field based on another field arholly Access VBA 6 November 22nd, 2006 11:19 AM
putting a date into a date field elladi Classic ASP Databases 2 March 31st, 2005 01:30 PM
Passing date parms into a DTS pkg with dtsrun gbrockman SQL Server DTS 2 October 26th, 2003 05:54 PM
Convert String Date to Date for a SQL Query tdaustin Classic ASP Basics 4 July 7th, 2003 06:01 PM
Import Date Format daver676 Access 5 June 28th, 2003 08:06 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.