CONVERT function

I am still using ASA 7, I had the following records, they
are varchar(20) datatype

07.09.2007 11:12:00   ---> wants to be 2007-09-07 11:12:00
08.09.2007 11:13:00   ---> wants to be 2007-09-08 11:13:00
09.09.2007 11:14:00   ---> wants to be 2007-09-09 11:14:00
10.09.2007 11:15:00   ---> wants to be 2007-09-10 11:15:00

and I want to convert it into datetime type, I did as follow
but does not work:

SELECT CONVERT(VARCHAR(20), order_date, 121)
FROM sales
what did I miss?
9/10/2007 1:25:59 PM
sybase.sqlanywhere.general 32637 articles. 4 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 11


I did not try this, but how I understand the documentation, convert  
converts either form string to datetime or vice versa. So you would have  
to convert from varchar to datetime, and from datetime to varchar, using  
two nested calls of convert, and appropriate formats so the inner one  
recognizes the date format of the source, while the outer format produces  
the correct format from the datetime to varchar.


On Mon, 10 Sep 2007 15:25:59 +0200, <> wrote:

> I am still using ASA 7, I had the following records, they
> are varchar(20) datatype
> 07.09.2007 11:12:00   ---> wants to be 2007-09-07 11:12:00
> 08.09.2007 11:13:00   ---> wants to be 2007-09-08 11:13:00
> 09.09.2007 11:14:00   ---> wants to be 2007-09-09 11:14:00
> 10.09.2007 11:15:00   ---> wants to be 2007-09-10 11:15:00
> and I want to convert it into datetime type, I did as follow
> but does not work:
> SELECT CONVERT(VARCHAR(20), order_date, 121)
> FROM sales
> what did I miss?
> Regards
> Winanjaya

9/10/2007 1:52:26 PM

Similar Artilces:

Using CONVERT function to convert NUMERIC to VARCHAR
I am creating a trigger on a table where 2 columns are defined as numeric. This trigger captures the data and inserts it into another table where I want to combine the numeric data with a statement. I've tried using the CONVERT function, but it is giving me a mis-matched token error. I've looked through the documentation online, but it is not really helping me or I'm not understanding correctly. I've pasted a snippet of what I'm trying to do without using the CONVERT function. **user_level and region_id are the numeric values** select @whatchanged = case ...

Converting JS function to a "vb" function
I am trying to take this js function<SCRIPT LANGUAGE="JavaScript"> var win26002604;if (!win26002604){"frmIMsg.aspx?Owner=&League=&Team=2:42:26 PM&RecipientID=2604","win26002604","toolbar=no,menubar=no, width=350 ,height=350"); } </SCRIPT>" And convert it into a function I can call from server side code like this Public Shared Sub ASPNET_ChatPopupOpen(ByVal strSenderID As String, ByVal strRecepientID As String, ByVal strLeague As String, ByVal strTeam As String, ByVal strRecepient As...

Convert() function
Hi, I have found some ways on using Convert() function for SQL server. But i do not understand some of them. Example: CONVERT(VARCHAR(10),column name,108) What is the 108 for? I see some with 120 and 101. I tried all but only 108 is working for me the way I want..but i do not understand what is that for actually. Can anyone explain it to me? Thank you. Hi, You can get the time part of a date column value as varchar by using the convert function with style 108 Say, select top 1 ApplicationDate from Applications returns "2003-04-11 15:20:00" Then SELECT top 1 CONVERT(VARCHAR(10), A...

Function functionality ?
Hello, I have a Function : create Function F1 ........ as update T1 set col1=col1+1; commit; return col1; end; Lets say col1 value before the func. is called is 100. Now, if user1 executes this function and user2 also executes the same function, at the same time. 1) What value is returned for user1 and user2. Would that update stt. locks the table, and allows only 1 user to access it? 2) My requiemnent is that the 2 users should get different values from the function. thanks for your help -Sravan Sravan wrote... > Hello, > I have a F...

What generals generally do
Reading a McChrystal thread elsewhere, I came across someone quoting a US general > I spent 33 years and four months in active military service and > during that period I spent most of my time as a high class thug for > Big Business, for Wall Street and the bankers. In short, I was a > racketeer, a gangster for capitalism. I helped make Mexico and > especially Tampico safe for American oil interests in 1914. I helped > make Haiti and Cuba a decent place for the National City Bank boys to > collect revenues in. I ...

UserObjects, Functions and variables - access userobject functions from popupmenu
I have a visual userobject in charge of managing info related to different data in the application ( Items , company, purchase order,....) This user object has, in summary, - a datawindow to show the list of related documents, with a retrieval argument ( depending on the the related data ) - a popup menu on the rightbutton click, giving access to classical funstions like Create, modifiy, delete. - several functions, in particular, a function to retrieve the datawindow, according the argument passed by the parent window, and a function to delete a line, function in which a lot o...

Help convert MS Access function to MS SQL User Defined Function
I have this function in access I need to be able to use in ms sql.  Having problems trying to get it to work.  The function gets rid of the leading zeros if the field being past dosn't have any non number characters.For example:TrimZero("000000001023") > "1023"TrimZero("E1025") > "E1025"TrimZero("000000021021") > "21021"TrimZero("R5545") > "R5545"Here is the function that works in access:Public Function TrimZero(strField As Variant) As String   Dim strReturn As String   If IsNull(strField) = True Then      strReturn = "" ...

SQL Convert function
I am trying to concatenate a string to a currency amount so that I can show both in a drop down list box.  However when I create the SQL to do this using the Query tool I get a message to say that I must use the Convert funtion to convert the currency amount.Anyone know the SQL syntax for this function as I can seem to get it to work. ThanksPaul How does the string which you tried to use as currency look like? In SQL there is a MONEY datatype, which accepcts values like $999:DECLARE @m moneySET @m=$234325SELECT @mWelcome to my SQL/ASPNET forum for Chinese

help converting function
Hi, I've been using this function for my datasets for my applications for awhile, its working fine, but I should be using datatables when I can I believe.  I'm trying to convert the below function to use datatables instead of datasets to improve.  Could anyone lend a hand on helping me getting this going with datatabes?   Any help is much appreciated.Thanks! mike123    Public Function select_Users(ByVal genderID As Int16) As DataSet Dim myDataSet As New DataSet If HttpContext.Current.Cache.Get("select_Users" & CStr(genderID)) Is Nothing...

Date convert function
Dear All, I used following queary form shows all record greter than date. But in this queary it match with only day means with only '26' not with hole date, It shows record only greater th 26 but all years. I want to match with exact date. How ? select TransId,Account,Debit,Credit,CONVERT( varchar(12),RefDate,105) from JDT1 where (CONVERT( varchar(12),RefDate,105) >= '26-10-2006')  hitry this select TransId,Account,Debit,Credit,CONVERT( varchar(12),RefDate,105) from JDT1 where (CONVERT( varchar,RefDate,103) >= '26-10-2006') ...

Converting Sub to Function
Hi All  I would very much like to convert a number of my subs that interact with my database into functions that i can then store in a class but i am unsure about 1 part If i have the following as an example sub Public Sub Insert() Dim ConnString As String = GetConnString() Dim SqlString As String = "Insert Into Contacts (FirstName, LastName) Values (@FirstName,@LastName)" Using conn As New OleDbConnection(ConnString) Using cmd As New OleDbCommand(SqlString, conn) cmd.CommandType = CommandType.Text ...

CONVERT function use
I'll go right to the point: I have a textbox in wich the user can seize a "money" value. But when i'm doing the INSERT command, it fails and says I cannot implicitely convert nvarchar data (mytextbox.text) to money data. I don't know how to handle this... objCmd = New SqlCommand("INSERT INTO tbl_appel_service_pieces " & _ "(fld_nom_piece, fld_quantite, fld_prix, fld_description, fld_num_appel) " & _ "VALUES (@fld_nom_piece, @fld_quantite, @fld_prix, @fld_description, @fld_num_appel)", objConn) objCmd.Parameters.Add(&qu...

Again some C++ functions to convert
Hi All, Sorry to bother you again, but converting C++ header files into Delphi isn't as easy as I thought. struct GbeEventInfo { uint16_t type; union { struct { uint32_t port; } discovery; struct { uint16_t reqId; uint16_t index; uint16_t eventId; uint16_t streamChannelIndex; uint16_t blockId; uint64_t timestamp; uint16_t dataLen; const uint8_t* data; } gevevent; } data; }; typedef int (*Gbe_BoardEventCallbackFunc_t)(struct BoardHandle *boardHandle, const GbeEventInfo * const eventInfo, const void* userData); int Gbe_i...

The Convert Function in Where clause..
Hi Sybase team Today, my doubts are referred with the convert function used in a Where clause... If my memory don't fail me .. the convert function is not desirable in the where clause when the values converted in the sentence are columns because Sybase take this convertion as a table scan over the column of the specific table .. it's this afirmation true ? Ok it's true, but what's happend when the sarg clause use a join over two columns of distinct tables and the convert function is present in both sides? Table sc...

Web resources about - CONVERT function - sybase.sqlanywhere.general

Talk:Trigonometric functions - Wikipedia, the free encyclopedia
This article is within the scope of WikiProject Mathematics , a collaborative effort to improve the coverage of Mathematics on Wikipedia. If ...

Fatally weak MD5 function torpedoes crypto protections in HTTPS and IPSEC
... US Navy ) If you thought MD5 was banished from HTTPS encryption, you'd be wrong. It turns out the fatally weak cryptographic hash function, ...

Drop Point Knives: Function, Fit, Timeless
Drop Point Knives: Function, Fit, Timeless

Learning F# – The Thunderdome Principle for Functions
... One object enters, one object leaves! What I like about F# is that the language designers took a similar approach when they implemented functions. ...

HPE Offers Catalog of Virtual Network Functions for Telcos
The vendor's OpenNFV Solution Portal gives carriers a single place to find a range of VNFs that are pre-tested to run on their networks.

7 Useful Technical SEO Functions For Your E-commerce Website
This article was co-authored by Mate Dyekiss, SEO Strategist at IMI. An e-commerce website can create all the technical SEO issues onecan imagine: ...

Using AWS Lambda functions to create print ready files
... going to tell you about our processing architecture as well as at a recent performance improvement with the integration of AWS Lambda functions. ...

Political row over omitting Kerala CM from PM Modi’s function
Kerala chief minister Oommen Chandy on Saturday decided to keep away from Prime Minister Narendra Modi’s function in Kollam in south Kerala after ...

Surprise: Binge-Watching TV May Cause a Decline in Brain Function
With the second season of Transparent only a few days away, some bad news awaits us: According to a recent study and common sense, probably, ...

Power Through Your Work With a “Forcing Function”
... to flow faster and more easily when I know I only have a couple of hours to turn it in. Entrepreneur Dan Martell calls this a “forcing function” ...

Resources last updated: 1/21/2016 4:24:55 PM