473,651 Members | 2,562 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DTS Local Package - Date Formatting

28 New Member
Hi, I am coding a DTS Local Package that transfers Access Data into SQL Data. I am pulling 2 fields: a month and a year. The month format is "Jan, Feb, Mar, Apr, May, Jun, etc.), the year format is "2007, 2008, 2009, etc". What I want to do is put these 2 fields together into one column in SQL in this format: "200701" instead of "2007Jan". Or for Feb: "200702".

Here is the code that I have, but I want to make it simpler and quicker:

Function Main()

if len(month(CDate (DTSSource("'ye ar'") & "-" & DTSSource("'mon th'") & "-1"))) < 2 then

DTSDestination( "demand_period" ) = DTSSource("'yea r'") & "0" & month(CDate(DTS Source("'year'" ) & "-" & DTSSource("'mon th'") & "-1"))

else

DTSDestination( "demand_period" ) = DTSSource("'yea r'") & month(CDate(DTS Source("'year'" ) & "-" & DTSSource("'mon th'") & "-1"))

end if

Main = DTSTransformSta t_OK

End Function

Is there a quick way to do this in VB coding? Thanks
Nov 14 '07 #1
0 871

Sign in to post your reply or Sign up for a free account.

Similar topics

4
12670
by: chris.dunigan | last post by:
I'm looking for an example of how to execute an existing DTS­ package from an ASP (VB)script and would appreciate any and all response. ­I don't even know if it's possible Thanks - Chuck Gatto Dan Guzman Apr 27 2000, 12:00 am show options
2
6957
by: Tatiana Zadiraka | last post by:
I use DB2 8.1 with FixPack 5. In command line for sql I get all DATE columns only in MM-DD-YYYY format. Of course, DATE('20-12-2003') gives me an error SQL0181N The string representation of a datetime value is out of range. SQLSTATE=22007 My db config is: Database territory = RU
12
1742
by: Rob T | last post by:
I'm storing a date/time into a SQL table of type datetime. I need it to be precise so the value is stored to the 1000th of a second. ie "insert into myTable mydate values ('08/05/2005 2:56:11.987'). This works fine...if you check the value in the table with query analyzer, it shows in there properly. Now, in my app, I'm executing the same query (that I used in QA) and storing tha in a dataview. If I break and watch the program, the...
2
2265
by: David Veeneman | last post by:
How does one format a date column in a GridView control? I had assumed that the DataFormat string would do it, but MSDN only shows numeric formatting codes. Can dates be formatted using that property, or is it done some other way? Thanks in advance. -- David Veeneman Foresight Systems
0
3230
by: robpimentel | last post by:
Hi, I've been using DB2 for about 1 week, so please bear with me. DB2 Connect Enterprise Edition v8.1 FixPack 5 Windows Server 2003 Standard Edition SP1 Here is an error that continues to appear on our domain controllers (Security event log): Event Type: Failure Audit Event Source: Security
3
3289
by: Jim in Arizona | last post by:
I have a gridview that's being populated from an access db query. The problem I'm having is that the date/time fields in access that are populating the gridview are showing both date and time, when the field should only be showing one or the other (date or time). Even on the back end of the database where the column properties are, I have chosen the smallest date/time formats. When the aspx page runs, it shows the date and time (ie:in a...
0
842
by: LimaCharlie | last post by:
Good day to all, My frontend is visual basic and my backend is SQL. I need to pass a date parameter to my DTS Package. What should be my VB syntax? Here's how I call my DTS package: Private Sub DTSAccess() Dim objPackage As New Package objPackage.LoadFromSQLServer "SQL2K-VBP", , , DTSSQLStgFlag_UseTrustedConnection, , , , "HRIS_DTSFromAccess" objPackage.Execute
0
1029
by: Kevin Frey | last post by:
Our database stores all date-time values in UTC format. When I display this data in a GridView (using a HyperLinkField) I'd like to display the equivalent local-time instead. It seems to me that this would have been trivially easy if there was a formatting string that would make the conversion prior to formatting. But alas there appears to be no such capability. Without this approach, I'm not sure where I would inject the "ToLocalTime"...
0
3875
debasisdas
by: debasisdas | last post by:
The following thread contains some useful tips/sample codes regarding PACKAGES in oracle, that the forum members may find useful. A package is a collection of procedures,functions,cursors,global variables etc. A package is also stored as an Object in the database. A package ha s two parts 1. Package-------------Specification. 2. Package body---Implimentaton.
0
8345
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8273
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8789
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8693
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8456
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6156
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4143
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4279
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2694
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.