February 20, 2009 at 9:49 am
I get the error "Only one expession can be satisifed in the select list when the subquery is not introduced with EXISTS.
I know I'm not seeing something
IF (select * from [tpqaplantsql\plantdb].LoggerReport.dbo.logger2)=0
select * from [tpqa2appclstr\qa2appdb].Logger.dbo.logger2
ELSE
select * from [tpqa2appclstr\qa2appdb].Logger.dbo.logger2
where id > (Select logkey from [tpqaplantsql\plantdb].LoggerReport.dbo.loggerstart)
February 20, 2009 at 9:53 am
IF (select * from [tpqaplantsql\plantdb].LoggerReport.dbo.logger2)=0
Should that have "count" in the select?
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
February 20, 2009 at 9:55 am
you want to test IF EXISTS(any rows in logger2)
not that (somequery = 0)--you weanted to count the rows or something, right?
so you'd want to tweak it to something like this:
IF EXISTS(select * from [tpqaplantsql\plantdb].LoggerReport.dbo.logger2)
select * from [tpqa2appclstr\qa2appdb].Logger.dbo.logger2
ELSE
select * from [tpqa2appclstr\qa2appdb].Logger.dbo.logger2
where id > (Select logkey from [tpqaplantsql\plantdb].LoggerReport.dbo.loggerstart)
Lowell
February 20, 2009 at 10:14 am
Lowell (2/20/2009)
you want to test IF EXISTS(any rows in logger2)not that (somequery = 0)--you weanted to count the rows or something, right?
so you'd want to tweak it to something like this:
IF EXISTS(select * from [tpqaplantsql\plantdb].LoggerReport.dbo.logger2)
select * from [tpqa2appclstr\qa2appdb].Logger.dbo.logger2
ELSE
select * from [tpqa2appclstr\qa2appdb].Logger.dbo.logger2
where id > (Select logkey from [tpqaplantsql\plantdb].LoggerReport.dbo.loggerstart)
You also need to change the "where" clause
IF EXISTS(select * from [tpqaplantsql\plantdb].LoggerReport.dbo.logger2)
select * from [tpqa2appclstr\qa2appdb].Logger.dbo.logger2
ELSE
select * from [tpqa2appclstr\qa2appdb].Logger.dbo.logger2
where id > (Select MAX(logkey) from [tpqaplantsql\plantdb].LoggerReport.dbo.loggerstart)
* Noel
February 20, 2009 at 11:30 am
THANKS !!! Everyone...!
That did the trick
Good karma to you all.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply