Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

unable to query seconds, sybase rounds to nearest minute

Posted on 2009-04-01
4
Medium Priority
?
550 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 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
In today's business world, data is more important than ever for informing marketing campaigns. Accessing and using data, however, may not come naturally to some creative marketing professionals. Here are four tips for adapting to wield data for insi…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

783 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