Solved

unable to query seconds, sybase rounds to nearest minute

Posted on 2009-04-01
4
544 Views
Last Modified: 2012-05-06
im running the following query

Select * from calldetail where callstartdt > '03/01/2009'

and its returning hte information i need, but there is a problem

its giving me Mar  2 2009  1:13PM

when it should give me the full date including the seconds, which exists in the database

how can i tell sybase to give me the full time, including seconds.
0
Comment
Question by:funnymanmike
  • 2
4 Comments
 
LVL 10

Accepted Solution

by:
bret earned 500 total points
ID: 24040527
The formating  of DATETIME values is up to the client application.   What kind of client are you using?  For that matter, which of the Sybase database products are you using (ASE, Sql Anywhere, Sybase IQ, Advantage)?

In ASE you can force the format by having the server convert the value to a string with a given format before sending it to the server, using the convert() function with a style specified:


1> select getdate()
2> go
                           
 --------------------------
        Apr  1 2009  9:37AM

(1 row affected)

1> select convert(varchar(30), getdate(), 109)
2> go
                               
 ------------------------------
 Apr  1 2009  9:39:48:880AM    

(1 row affected)



:

0
 
LVL 5

Author Comment

by:funnymanmike
ID: 24040792
Thanks bret but this format does not work for me as well, there is just too much information in here again

i don't need the :880AM  just the  Apr  1 2009  9:39:48

in fact the :880 & the AM/PM screws up my excel file
0
 
LVL 5

Author Closing Comment

by:funnymanmike
ID: 31565360
Thanks, i started playing around wiht the 109, and when i selected 108 i found just the HH:MM:SS so i created new columsn in my query for just that and everything worked great. Thanks
0
 
LVL 14

Expert Comment

by:Jan_Franek
ID: 24041023
Look at http://infocenter.sybase.com/help/topic/com.sybase.dc36271_1251/html/blocks/X41864.htm#X53500 - it's manual page for convert function and Table 2-6 shows all possible date formats - this is for ASE 12.5, if you are on different version of ASE, try to find the same manual page for your version at sybooks.sybase.com
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

SQL Command Tool comes with APEX under SQL Workshop. It helps us to make changes on the database directly using a graphical user interface. This helps us writing any SQL/ PLSQL queries and execute it on the database and we can create any database ob…
This article explains all about SQL Server Piecemeal Restore with examples in step by step manner.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question