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 imported, I want
to convert the date column to date type.
For ex. the text file look like
Name date
Smith 20003112
Jennifer 19991506
It would be converted date column to ydm database in SQL 2000 server.
In the table it should look like this
Name Date
Smith 2000.31.12
Jennifer 1999.15.06
Thanks in advance
- Loi - 1 67389
Loi,
If you want to store the data as type datetime, it will not "look like"
anything in the table. However, you can make it look however you
want when you select the results. Date values are stored as bits, not
as formatted character strings. The yyyy.dd.mm format is not one of
the numbered formats to use with convert(), so you will need to select
your datetime value and use string functions to format it. Try this:
select convert(char(4) ,[date],112) + convert(char(5) ,[date],4) from
yourTable
Steve Kass
Drew University
Loi Tan Vo wrote: 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 imported, I want to convert the date column to date type.
For ex. the text file look like
Name date Smith 20003112 Jennifer 19991506
It would be converted date column to ydm database in SQL 2000 server. In the table it should look like this
Name Date Smith 2000.31.12 Jennifer 1999.15.06
Thanks in advance
- Loi -
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Lauren Quantrell |
last post by:
I have a stored procedure using Convert where the exact same Convert
string works in the SELECT portion of the procedure but fails in the
WHERE portion.
The entire SP is listed below.
Specifically, I have a problem with this portion in the WHERE clause:
DATEADD(Day,tblMyEventTableName.ReminderDays, @DateNow) Between
CONVERT(smalldatetime,str(DATEPART(Month, @DateNow)+1) + '/' +
str(DATEPART(Day, tblMyEventTableName.TaskDateTime)) + '/'...
|
by: Google Jenny |
last post by:
Precisely, here's what I need:
When I run getdate(), I get, for example:
August 9 2004 5:17 P.M.
I want to turn the date portion into:
8/9/2004 format and update one column with it
|
by: Dan S |
last post by:
My application asks the user to enter in a date - in the mm/dd/yyyy format. Is there any quick and easy way to verify the date the user enters is formatted correctly? Right now I'm calling DateTime.Parse() and catching the FormatException but it seems this is a bit inefficient - catching the exception that is. There is some pretty obvious delay while it traces back up the call stack. Is there a better way? Something that returns a bool...
|
by: jguilford |
last post by:
I have created a SQL Stored Procedure that uses a Case statement to
determine the Order By. For one of the Case statements I am trying to
turn a Char field into Datetime in for the Order By, however I can not
get it to work. Can someone please take a look and my code below and
tell me what I am doing wrong. Thank you.
ORDER BY
CASE WHEN @SortBy = 'dttm_stamp' THEN dttm_stamp End,
CASE WHEN @SortBy = 'Event_Date1' THEN...
|
by: Assimalyst |
last post by:
Hi i have a value entered into an asp text box,
procedureDateTxtBx.Text, thet has the format dd/MM/yyyy. I need to
convert this into a format recognisable by SQL server in order to
properly query the database.
I've tried a few DateTime.Parse methods but can't get any to work.
The format of these values in the database is
yyyy-MM-dd hh:mm:ss.000
| |
by: Terry Jolly |
last post by:
New to C# ---- How do I convert a Date to int?
In VB6:
Dim lDate as long
lDate = CLng(Date)
In C#
|
by: izziy |
last post by:
Our legacy DB has a bad column which stores a date value as char(8), it has a format like 'MMDDYYYY'.
I am creating a report to report this particular date and also use this date to specify a range.
I tried using this
SELECT Convert(datetime,(substring(c.dateofreceipt,5,4)+'-'+substring(c.dateofreceipt,1,2)+'-'+substring(c.dateofreceipt,3,2)), 102) as dateofreceipt
in query analyzer and it works fine. But in .Net report designer,...
|
by: Wes Peters |
last post by:
I have a situation where I want to filter records for a given day. The
field that stores the date/time uses the date() function as a default value,
kind of a date/time stamp for the record.
The problem is when I want to filter records for a given day instead of a
date range. I use the CONVERT function to return just the date part of the
field (101 as a style parameter) and compare that to a start and stop date
(both being the same) and...
|
by: RP |
last post by:
I am using SQL Server 2005 as backend. I have a Text Box that accepts
Date in the format dd-MM-yyyy. But when I attempt to insert a record,
an error is displayed: Cannot convert char to DateTime ....
Actually, when the text box has entry like 22-10-2005, it considers 22
as month whereas it is DD. How to convert the Text Box value to an
acceptable format.
I tried: DateTime.parse(txtDOB.Text,"dd-MM-yyyy")
|
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: 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: 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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |