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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Error showing comma

Author  Topic 

sqllearner
Aged Yak Warrior

639 Posts

Posted - 2004-10-04 : 13:00:41
Here When I execute the query it works but in the application its giving some error saying comma problem.Here the datecompleted is a string in the table

SELECT
MAX(ISNULL(DATECOMPLETED,'')) orderDate
FROM
tbl_track(nolock)
WHERE
mc_code = @unique_id

sqllearner
Aged Yak Warrior

639 Posts

Posted - 2004-10-04 : 13:24:26
if I use COALESCE will it have a difference to the above
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-10-04 : 13:32:55
Coalesce won't have any diff. if it works in the QA then maybe the problem is in your app?

Go with the flow & have fun! Else fight the flow
Go to Top of Page

sqllearner
Aged Yak Warrior

639 Posts

Posted - 2004-10-04 : 13:36:41
okay Thanks a lot
Go to Top of Page

sqllearner
Aged Yak Warrior

639 Posts

Posted - 2004-10-04 : 13:37:12
should I convert the date to datetime right now its varchar
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-10-04 : 13:51:07
well it depends on your date format.
if you store it in yyyymmdd then no
but if it's dd.mm.yyyy you should.

you probably should because that way you'll get the max date and not the max string.

Go with the flow & have fun! Else fight the flow
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2004-10-04 : 14:13:19
you are mixing two different return types in the same expression -- a date and a string. The same column in a resultset cannot have two different data types.

Why are you trying to replace NULL dates with '' ? What does that accomplish for you?

- Jeff
Go to Top of Page
   

- Advertisement -