Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread TableVersion function
Sun, May 25 2008 2:05 AMPermanent Link

"David Cornelius"
After some questions in a thread under elevatedb.sql named "table
version and updates", I decided to post the TableVersion function here.
It comes in quite handy when wanting to update a customer's database
and you need to query their current version of a table to decide how
which set of ALTER statements to execute.  Here it is for your EDB
library:


CREATE FUNCTION "TableVersion" (IN "TableName" VARCHAR COLLATE ANSI)
RETURNS FLOAT
BEGIN
 DECLARE VerCursor CURSOR FOR VerStmt;
 DECLARE Ver FLOAT;

 PREPARE VerStmt FROM
   'SELECT Version FROM Information.Tables
    WHERE Name = '''' + TableName + ''''';

 OPEN VerCursor;
 FETCH FIRST FROM VerCursor (Version) INTO Ver;
 CLOSE VerCursor;
 UNPREPARE VerStmt;

 RETURN Ver;
END


--
David Cornelius
CorneliusConcepts.com
custom designed software
Sun, May 25 2008 12:48 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

David,

Thanks for the contribution.

--
Tim Young
Elevate Software
www.elevatesoft.com

Image