Solved

unable to query seconds, sybase rounds to nearest minute

Posted on 2009-04-01
4
547 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

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

Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
Your data is at risk. Probably more today that at any other time in history. There are simply more people with more access to the Web with bad intentions.
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…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

626 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