Purchase Solution

SQL script to sort numbers across columns

Not what you're looking for?

Ask Custom Question

a user can add column to the table ,where the program sort them and display them sorted ,with sort i mean by row not order by;
order by is easy but sorting rows is harder,the difficultly comes with the fact that the user can add colums where the program should do the sort and display them in gridview.

attach document which describe the question more

Purchase this Solution

Solution Summary

The sql script will create a table with 4 columns and a user defined function that can take in these 4 values and produce a string where numbers are sorted in ascending order. Another query is provided that makes usage of this user defined function to produce an extra 5th column with sorted row results. The scripts are made in such a way that adding 5th, 6th, etc column should be an easy task.

Solution Preview

Dear student, please find attached SQL scripts that gives you the results as you have requested.

The solution is based on usage of SQL user-defined function which is named UF_MY_SORT_COLUMNS which takes as parameters integers and returns a string of these numbers sorted.

Please replace [BM] with the name of your ...

Purchase this Solution


Free BrainMass Quizzes
Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

C++ Operators

This quiz tests a student's knowledge about C++ operators.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.