You sure that's an ANSI SQL statement. Looks like a procedure. I am not
familiar with SQL Server, but some functions here might be also dependent on
the tool used to execute this procedure. You should run as a stored
procedure, see docs. Also what error message are you getting and some code
would be helpful. Usually procedures should end with ; unlike queries
inside the string passed to prepare().
Ilya Sterin
-----Original Message-----
From: Kutler, Christopher
To: 'DBI User Group'
Sent: 04/17/2001 10:36 AM
Subject: Complex SQL statments - Do they work?
Hello All
I've tried the following SQL statement which does work via SQL Server
6.5.
However, it does't seem to work when I run the same statment through
DBI:
select p.pieceref, d.document_id, dd.full_date,
grant_description, heading,
convert(varchar(255), document_type_description) as
document_description,
physical_format,
number_of_folios_etc, language = CASE
when english_indicator = 1 then 'English'
when french_indicator = 1 then 'French'
when Latin_indicator = 1 then 'Latin'
END, convert(varchar(255), document_note) as document_note,
names_indicator = CASE names_indicator when 1 then 'includes names of
individuals' END,
goods_indicator = CASE goods_indicator when 1 then 'includes record of
goods
assessed' END
from list_heading as lh
inner join piece_heading as ph on lh.heading_id = ph.heading_id
inner join piece as p on ph.piece_id = p.piece_id
left outer join document as d on p.piece_id = d.piece_id
left outer join document_grant as dg on d.document_id = dg.document_id
inner join grant_ as g on dg.grant_id = g.grant_id
inner join document_date as dd on d.document_id = dd.document_id
order by p.pieceref
Any help would be appreciated.
thanks
Chris