# PROP:SQL select into alias - does it make sense

**URL:** <https://clarionhub.com/t/prop-sql-select-into-alias-does-it-make-sense/1297>\
**Category:** questions\
**Tags:** sql\
**Created:** [July 5, 2017, 11:54am UTC](https://clarionhub.com/t/prop-sql-select-into-alias-does-it-make-sense/1297 "2017-07-05T11:54:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Johan\_van\_Zyl](https://clarionhub.com/user_avatar/clarionhub.com/johan_van_zyl/32/1606_2.png) [@Johan\_van\_Zyl](https://clarionhub.com/u/Johan_van_Zyl)\
**Post date:** [July 5, 2017, 11:54am UTC](https://clarionhub.com/t/prop-sql-select-into-alias-does-it-make-sense/1297/1 "2017-07-05T11:54:14Z")

</div>

regionslookup is an alias of REGIONS - does this make sense  
records in regions = 34 and printable = 1 = 16  
records in regionslookup = 34 - obviously

```
regionslookup{PROP:SQL}= 'Select * from regions where Printable=1 order by sortorder'
!message(records(regionslookup))
loc:recordsregions = records(regionslookup)!jvz
display(?loc:recordsregions)!JVZ
LOC:countregionerrors = 0 !JVZ
LOOP
	Next(regionslookup)
	if error()
		stop('Regionslookup Region: '& CLIP(RegL:ShortName)&' '&errorcode()&' '&error())
	END

```

---

<div class="post-metadata">

**Author:** ![seanh](https://clarionhub.com/letter_avatar_proxy/v4/letter/s/4af34b/32.png) [@seanh](https://clarionhub.com/u/seanh)\
**Post date:** [July 5, 2017, 10:25pm UTC](https://clarionhub.com/t/prop-sql-select-into-alias-does-it-make-sense/1297/2 "2017-07-05T22:25:57Z")

</div>

I don’t know that the records(regionslookup) will work as expected.  
You need to be VERY careful using Select \* the order of fields returned may not be as expected.

Other than that it looks ok.

---

<div class="post-metadata">

**Author:** ![PurpleEdge2214](https://clarionhub.com/user_avatar/clarionhub.com/purpleedge2214/32/5109_2.png) [@PurpleEdge2214](https://clarionhub.com/u/PurpleEdge2214)\
**Post date:** [July 6, 2017, 12:56am UTC](https://clarionhub.com/t/prop-sql-select-into-alias-does-it-make-sense/1297/3 "2017-07-06T00:56:06Z")

</div>

No.

When using prop:sql, the structure you use for the prop:sql is just a record declaration into which data can be placed, it is not a file.

So…

```
CLEAR(Regions_Lookup,0)
regionslookup{PROP:SQL}= 'Select * from regions where Printable=1 order by sortorder'
IF ERROROCDE()
  STOP(FILEERROR())
ELSE
  LOOP
	Next(regionslookup)
	if error()
          BREAK
	END
        STOP('Regionslookup Region: '& CLIP(RegL:ShortName)&' '&errorcode()&' '&error())
  END
END

```

… should loop for each Printable record
