473,666 Members | 1,992 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

converting Date to Date or Char

4 New Member
Hi,
I have a table with one of the columns configured to record dates as ('#', 'MM/DD/YYYY'). However, two entries in that column are of format YYYY and MM/YYYY. How can I change only those two entries preferably to Date but in formats above?
i tried to do:
Expand|Select|Wrap|Line Numbers
  1.  
  2. "update table_name 
  3. set column_name = to_date('2008', 'YYYY')
  4. where c_id = 12"
  5.  
but it records the date in format MM/DD/YYYY with values 03/01/2008 (i dont know how it selects this specific date).
If it is not possible to change the date format of the column without affecting the whole column, how can I change my two specific formats to strings?
Thank you for help.
Mar 14 '08 #1
4 1737
debasisdas
8,127 Recognized Expert Expert
How is it possible that only 2 values are stored in different format ?
Mar 17 '08 #2
amitpatel66
2,367 Recognized Expert Top Contributor
You mean you want to update the two records to the formats of YYYY and MM/YYYY respectively?
Mar 17 '08 #3
nikos
4 New Member
How is it possible that only 2 values are stored in different format ?
The original table is from excel, so in excel there were those dates (year, and month and year) to indicate a start of event.
Mar 17 '08 #4
nikos
4 New Member
You mean you want to update the two records to the formats of YYYY and MM/YYYY respectively?
yeah, i basically need to select the year of 2003 and insert it into DATE configured column as 2003 without month or day. Another possibility would be to insert it as a string, but i would need to convert those two entries only (ie, YYYY and MM/YYYY)
Mar 17 '08 #5

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

Similar topics

3
45634
by: ola Alli | last post by:
Hi All, How do you convert int value to datetime datatype in sql server e.g 900mins to hh:mm:ss Regards Ola
1
2105
by: Sugapablo | last post by:
I have a table that's of type date/time (i.e. 01/01/1900 00:00:00). What I want is to do the following: Say you have these records: person | date-time -------+--------------------------- jim | 06/02/2004 00:05:52 jim | 06/02/2004 05:06:21
1
4435
by: Andrew Baker | last post by:
this seems to be an SQL Server error but I cant work out how it is occuring. Itr is also after 3am and I cant keep working but need to demo by tomorrow. TIA. The code is: Private Sub myMethod(ByVal cust As String, ByVal invDate As Date) Dim paramDate As New OleDb.OleDbParameter, Dim paramCustomer As New OleDb.OleDbParameter paramDate.ParameterName = "@InvDate" paramDate.Value = invDate
3
1457
by: Alpha | last post by:
I have 2 strings, "12/28/2005" and "16:44:54". I need to conatenate them and convert them to datetime format so I can assign them to a datetime field in a datarow. The time is now being converted to the date "12/28/2005". and I don't know how to concatenate them since "+" won't work after I convert them. Thanks, Alpha if (result == "00") { char separator = {','}; char intSep = {'.'};
12
2593
by: Rob Meade | last post by:
Hi all, Ok - I've come from a 1.1 background - and previously I've never had any problem with doing this: Response.Write (Session("MyDate").ToString("dd/MM/yyyy")) So, I might get this for example: 21/05/2006
0
1670
by: coolvivek33 | last post by:
hi i am facing a strange problem i am trying to build report using sql server 2005 and microsoft visual studio2005 now it is in requirement that i should seperate date from time.I have done that using visual studio with following code on one of the dataset values with the help of following code SELECT Convert(varchar, Deliverydate, 103) as displayValue FROM TimePeriodOrderDeliveryDate.This only dispalys the date part from the ate time...
3
7147
by: Jef Driesen | last post by:
How can I convert a date string to a number (e.g. a time_t value or a tm struct)? I know about the strptime function, but then I have to know the format string. And that is a problem. I'm trying to autoformat the contents of text entries in a GUI. For numbers, I'm converting the text representation to the appropriate type (using atoi, atof, ...) and converting the result back to text with the correct format (using sprintf). But this does...
3
7816
by: pali | last post by:
I have a char column that contains date/time information (YYYYMMDDTTTTTT) in the following format: 20071002160603 What is the most efficient way to show this information in a query result as "10/02/2007 16:06:03"? Thanks in advance.
5
32999
by: Hemant Shah | last post by:
Folks, How can I convert date/time/timestamp to an integer? According to UDB 8.1 docs that I have, INTEGER('1964-07-20') should return 19640720, but when I run the SQL statement I get different answer: # db2 "VALUES INTEGER(CHAR(1964-07-20))"
0
8871
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...
1
8551
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,...
0
8640
tracyyun
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...
0
7386
agi2029
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...
0
5664
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();...
0
4198
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...
1
2771
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
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1776
bsmnconsultancy
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...

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.