Hi,
I have a text file that contains a date column. The text file will be
imported to database in SQL 2000 server. After to be importing, I want
to convert the date column to date type.
For ex. the text file look like
Name date
Smith 06092006 023718
It would be converted date column to ydm database in SQL 2000 server.
In the table it should look like this
Name Date
Smith 2006-09-06 hh:mm:ss.mmm
i used the query
select convert(varchar (15), getdate(), 25) from table name
which gives me the current date in the desired format...how can i replace the current date parameter to include the column 'Date'???
Much thanks in advance
appreciate if someone can help on this....
2 8567 CODE:
select [Name],
( substring(Date, 5,4)+'-'+
substring(Date, 3,2)+'-'+
substring(Date, 1,2)+' '+
substring(Date, 10,2)+':'+
substring(Date, 12,2)+':'+
substring(Date, 14,2)) [Date]
from DateDemo OUTPUT:
2006-09-06 02:37:18
I had many dates to convert from text files in a recent data migration. I imported the text into a varchar field and created a date field to store the converted text date into. You can reformat the text and replace it into the original field, but if you want a true date field which you can do date calculations with, you must put it into a date field.
To keep your production table clean, you should do the date conversion in a temp table and only load the true date into your prod table.
HTH,
Eric
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Grey |
last post by:
I use the DateTime format to change the date format, i.e.
string a = "21/02/2004";
Convert.ToDateTime(a).ToString("MMMM dd, yyyy");
These two lines work well in my VS.NET development machine. But it fail in
my production server. I don't know the reason??
My development machine: winXP Pro, VS.NET 2003
My Production machine: Win2000 server with SP4, .NET Framework 1.1
--
Best Regards,
|
by: INeedADip |
last post by:
I have seen this problem posted all over, but have never ran across a
solution....
I am serializing my dataset and they look like this:
<NewDataSet>
<xs:schema id="NewDataSet" xmlns=""
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSet" msdata:IsDataSet="true"
msdata:UseCurrentLocale="true">
|
by: ziggislaw |
last post by:
hello
how can I convert DateTime from "25.12.2005" to "2005-12-25
00:00:00.000" ?
Now I have DateTime as string (I get it from <asp:label>).
Thanks
|
by: dubing |
last post by:
Hello everyone,
There is a field of DATETIME type in our Access 2000 database. PHP is
used to query the data and display the query results on the web. Does
Access provide any function that can convert DATETIME field into a more
user friendly format directly in query? I can do the following in
MySQL. How should it be done in Access?
SELECT DATE_FORMAT('1997-10-04 22:23:00', '%W %M %Y');
|
by: bonnie.tangyn |
last post by:
Dear all
In my ASP page, user can enter date in dd/mm/yyyy format. How can I use
Javascript to convert dd/mm/yyyy to yyyy-mm-dd hh:mm:ss.
Please give me some advices.
Cheers
Bon
| |
by: bhv |
last post by:
hello everybody, i have datetime format in mysql database table. now,
in mysql date is YYYY-MM-DD format. how can i insert date in this
format with VB Script ? i had tried following
dim dt, dy, dm, dd, pd, tm
tm = Time
dt = Date
dy = DatePart("YYYY",dt)
dm = DatePart("M",dt)
dd = DatePart("D", dt)
|
by: joyjignesh |
last post by:
hi
i have make a report with mshflexgrid. the report between two date. when i have written query
.open"select * from tablename where t_date>=convert(datetime,' " & text1.text &"') and t2_date>=convert(datetime,' " & text2.text &"'),cn,,,adcmdtext
but there is a syntex error to converting datetime format into character string
plz help me
|
by: thomasc1020 |
last post by:
This is regarding VB.NET 2003.
Variable 'Date' is a string and it contains date information in this
format: "DEC/05/2007".
Now I am trying to convert the format as "2007-12-05".
Is it possible to convert the arrangement using 'Format' method?
If so, please educate me how I can do such operation.
Thank you!
|
by: huohaodian |
last post by:
Hi,
How can I convert a value created from DateTime.Now() to the datetime
format that SQL Server recognises?
Thanks in advance.
|
by: aext |
last post by:
Hi
please If you know how to convert from Decimal format of DateTime to a real Datetime Format reply please because i'm reading a decimal value of time from a file like this one (2448220711) and I Don't know how to get the real dateTime
from This Format .
I will be Thankful if You Reply
Aisha
|
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...
| |
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,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |