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 8565 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: 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...
| |
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...
|
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: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |