Solved

unable to query seconds, sybase rounds to nearest minute

Posted on 2009-04-01
4
546 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Read about achieving the basic levels of HRIS security in the workplace.
This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
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…

710 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