 BEGIN
 	DECLARE link varchar(128), run varchar(8), rerun varchar(8),
 		camcol varchar(8), field varchar(8), run6 varchar(10);
-	SET link = (select value from SiteConstants where name='DataServerURL');
+	SET link = (select val from SiteConstants where name='DataServerURL');
 	SET link = link || 'imaging/';
 	SELECT  run = cast(run as varchar(8)), rerun=cast(rerun as varchar(8)), 
 		camcol=cast(camcol as varchar(8)), field=cast(field as varchar(8))

BEGIN
	DECLARE link varchar(128), run varchar(8), rerun varchar(8),
		camcol varchar(8), field varchar(8), run6 varchar(10);
	SET link = (select value from SiteConstants where name='DataServerURL');
	SET link = link || 'imaging/';
	SELECT  run = cast(run as varchar(8)), rerun=cast(rerun as varchar(8)), 
		camcol=cast(camcol as varchar(8)), field=cast(field as varchar(8))

END;

CREATE FUNCTION fEnum(
	val binary(8), 
	type varchar(32), 
	length int)
RETURNS varchar(64)
