Monday, November 5, 2012

RANK function to create primary key for a Remedy View Form

To create Remedy View Form, you will need a database table or view that contains a numeric primary key. Since your table or view might not have a column that fits this requirement, you may need to dynamicall y create one in the building of the view.

Use the RANK function to create an incrementing value and then cast it as a an integer:

CAST(RANK() OVER(ORDER BY TERM,CAMPUS,BUILDING,ROOM,CRS_PREFIX,CRS_NUMBER,CRS_SUFFIX) AS int) AS Record

No comments:

Post a Comment