• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 453
  • Last Modified:

DTS Package Creation

Hi All,
Please help on the following DTS package construction:
From flat file we exporting data to MS SQL2000 where under 2 tables called Date and Time we uploading comma separated values like :

20071009;054415;

Please advice on best solution how those values to be exported directly to Table1 as:
2007-10-09 as Date and 05:44:15.000 as Time

Please, we need data to be exported as requested format. Running query after export......we need to sleep at that time :). Data type (On database Table1) can be change as per your recommendation. We didnt succeed that much with exported data and changing data type to....date or time
All suggestions are welcomed.

Thanks in advance!
0
batman_k
Asked:
batman_k
  • 2
  • 2
1 Solution
 
Eugene ZCommented:
use varchar datatype in the sql server tables and convert function
/SQL Server 2005 Books Online  CAST and CONVERT (Transact-SQL)  /

 

for example:

select convert (varchar(10),getdate(),120)
2007-10-10

--
select convert (varchar(11),getdate(),114)
12:32:27:88
0
 
batman_kAuthor Commented:
Hi Eugene,
Thats why you are "Genuis" and we......

Please explain it in actual DTS package where this will go.
We are not that much in Transact-SQL
0
 
Eugene ZCommented:
everyone is Genuis just does not know yet:)
---

you can import (DTS) in temp table as step 1
then as step 2 insert into destination table your "fixed" data

--
you can use Bulk insert instead of dts

http://msdn2.microsoft.com/en-us/library/ms188365.aspx


see example;

http://www.sqlteam.com/article/using-bulk-insert-to-load-a-text-file
0
 
batman_kAuthor Commented:
Sorry for delay
0

Featured Post

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now