Your SQL command was:
CREATE TABLE #upload ( up_id int, up_name varchar(32), up_ra float, up_dec float ) 
INSERT INTO #upload values ( 1, 'A1', 195.2, 2.5),( 2, 'A2', 194.5, 2.6),( 3, 'A3', 193.6, 2.8),( 4, 'A4', -90.1, -90.051)
create table #x (up_id int,objID bigint)
INSERT INTO #x 
SELECT up_id, dbo.fGetNearestObjIdEq(up_ra,up_dec,0.5) as objId 
     FROM #upload WHERE dbo.fGetNearestObjIdEq(up_ra,up_dec,0.5) IS NOT NULL 
SELECT u.up_name as [name], 
   p.objID, p.ra, p.dec, p.run, p.rerun, p.camcol, p.field,
   dbo.fPhotoTypeN(p.type) as type,
   p.modelMag_u, p.modelMag_g, p.modelMag_r, p.modelMag_i, p.modelMag_z 
FROM #x x, #upload u, PhotoTag p
WHERE u.up_id = x.up_id and x.objID=p.objID 
ORDER BY x.up_id
		

Your query output (max 500,000 rows):

nameobjIDradecrunreruncamcolfieldtypemodelMag_umodelMag_gmodelMag_rmodelMag_imodelMag_z
A11237651754016965215195.2034276675632.4984729545723314623014466GALAXY23.899221.4242220.5734719.7257619.14023
A21237651754016637114194.4982001720822.5993343902013514623014461STAR23.892424.2315123.7850422.0624423.31111
A31237651736836637478193.5979245496592.8011930532706814583014459GALAXY24.0897122.8910721.6183121.6156520.43842

Use the button below to upload the results of the above query to the SAS and retrieve the corresponding FITS files:

Upload list of fields to SAS