Solved

unable to query seconds, sybase rounds to nearest minute

Posted on 2009-04-01
4
540 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
Shadow IT is coming out of the shadows as more businesses are choosing cloud-based applications. It is now a multi-cloud world for most organizations. Simultaneously, most businesses have yet to consolidate with one cloud provider or define an offic…
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now