Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Date from Sybase

Author  Topic 

mikedcmdva
Starting Member

7 Posts

Posted - 2012-01-26 : 12:40:21
Hello everyone!

I am having a rough issue here. I have a Sybase database for which I need to run a query on to select data based on a column named "regdate" which has a datatype of "DATE".

One particular row has a value in the row of this column of "8/2/1999".

Whenever I run a:

select * from daily where regdate = '8/2/1999'

It says:

Restricted data type violation: Cannot convert 8/2/1999 to a timestamp.

What would be the best way to go about working around this? This is not my database so I can't modify the tables in any way.

Sorry if this is a newbie question....I have tried SQL CONVERT examples but I haven't gotten anywhere..

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2012-01-26 : 13:07:39
This site is primarily for MS SQL SERVER. Try over at http://www.dbforums.com/sybase/

http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspx
How to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

For ultra basic questions, follow these links.
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2012-01-26 : 13:35:08
select * from daily where regdate = #8/2/1999#

????



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2012-01-26 : 13:37:00
http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.help.ase_15.0.commands/html/commands/commands98.htm


Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

mikedcmdva
Starting Member

7 Posts

Posted - 2012-01-26 : 13:50:34
quote:
Originally posted by X002548

select * from daily where regdate = #8/2/1999#

????



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/







Doesn't work. "Syntax error or access violation: near '#' in ...regdate = #8/2/1999[#]
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2012-01-26 : 14:00:41
Can you post the DDL of the table?

My guess that you are thinking that a timestamp is datetime, when IT IS NOT



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2012-01-26 : 14:33:48
http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.help.ase_15.0.sqlug/html/sqlug/sqlug215.htm

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page
   

- Advertisement -