text textmerge to lcScript noshow ALTER PROCEDURE GetDetailCount(@Num1 int) As SELECT Count([ItemNo]) AS CountOfItemNo FROM Detail WHERE [OrdNr] = @Num1 GROUP BY [OrdNr]; return endtext sqlexec(Haendel, lcScript)IOW, creating a SP is just another SPT script. It's only a matter of rights - but I figure your app would have sufficient rights if it were to do the rest of the stuff anyway.