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 2005 Forums
 Express Edition and Compact Edition (2005)
 Need help on SQL

Author  Topic 

Delinda
Constraint Violating Yak Guru

315 Posts

Posted - 2010-07-20 : 14:54:31
In SQL Server below statement work fine,
select * 
from @t1 where maintdte != (select MAX(maintdte) from @t1)


How
select * 
from @t1 where maintdte != (select MAX(maintdte) from @t1) looks like in SQLCE
?

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-07-20 : 21:40:29
you need to try it in SQLCE and check the BOL for SQLCE. Not all syntax available in SQL Server is supported under SQLCE.


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

Delinda
Constraint Violating Yak Guru

315 Posts

Posted - 2010-07-21 : 02:28:45
I was try as follow,
SELECT        idx, Asset_idx, Details, MaintDte, Person_idx, HQRptNo, Commission_Flag, RE_SignOff_Flag, Created_By, Created_On, TagId
FROM nuRF_AssetMaintenanceRecords
WHERE (MaintDte <>
(SELECT MAX(MaintDte) AS Expr1
FROM nuRF_AssetMaintenanceRecords AS t1))


Got an error as follow,
There was an error parsing the query. [Token line number=1, Token line offcet=182, Token in error=SELECT]

I'm really stuck
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-07-21 : 02:46:44
It could simply means that syntax is not supported in SQLCE

Do it in 2 query
1. get the max of MaintDte
2. query where MaintDte <> result of (1)


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

Delinda
Constraint Violating Yak Guru

315 Posts

Posted - 2010-07-21 : 04:48:46
can you post some sample?
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-07-21 : 05:11:06
[code]
declare @max datetime
select @max = max(..) from ...
select .. .
from ...
where date = @max
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

Delinda
Constraint Violating Yak Guru

315 Posts

Posted - 2010-07-21 : 06:37:05
The Declare SQL construct or statement is not supported.

I hate this SQLServerCE
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-07-21 : 07:41:10
execute it as 2 separate statement. replace the declare will the your variable in your application


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

Delinda
Constraint Violating Yak Guru

315 Posts

Posted - 2010-07-21 : 08:47:06
oh. tq sir. i got that logic
Go to Top of Page
   

- Advertisement -