Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
Password Reminder
Register
| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #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
Reply With Quote
  #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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 06:08 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.