Tuesday, March 27, 2012

Case statement error

I have an sp that I am trying to run, but it keeps failing. Something like t
his
if a.one='PA' then
begin
select * from a
else
select * from b
end
I keep getting errors. I have tried a CASE statement, but it does not seems
to workIF EXISTS (SELECT one FROM a WHERE one='PA')
SELECT <column_list> FROM a
ELSE
SELECT <column_list> FROM b
"DBA" <DBA@.discussions.microsoft.com> wrote in message
news:4A5DC7F7-C8FE-4CA6-9F0D-C5108E871D65@.microsoft.com...
>I have an sp that I am trying to run, but it keeps failing. Something like
>this
> if a.one='PA' then
> begin
> select * from a
> else
> select * from b
> end
> I keep getting errors. I have tried a CASE statement, but it does not
> seems
> to work

No comments:

Post a Comment