Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I want to be able to put this statement into the prepare but don't know how to get DBD::Sybase to handle the delare bits ?
declare @name char(30)
declare @uid int
select @name=name, @uid=uid from $database..sysusers where suid = $suid
if (@name != null) exec $database..sp_dropuser @name
else if exists (select 1 from $database..sysalternates where suid = $suid)
exec $database..sp_dropalias $loginname
Just sticking the whole select in a prepare doesn't work e.g.
Any help appreciated$database="testdb"; $suid=1234; $loginname="joe"; $sth=$dbh->prepare("declare \@name char(30) declare \@uid int selec +t \@name=name, \@uid=uid from $database..sysusers where suid = $suid if (\@name != null) exec $database..sp_dropuser \@name else +if exists (select 1 from $database..sysal ternates where suid = $suid) exec $database..sp_dropalias $loginname") +; $sth->execute;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DBD Sybase and declare
by derby (Abbot) on Jan 18, 2006 at 13:40 UTC | |
|
Re: DBD Sybase and declare
by mpeppler (Vicar) on Jan 18, 2006 at 19:03 UTC |