When we insert random data into any table, now in order to sort those elements in the table we can use the following query.TO achieve this we create a temporary table using sql statement.
declare @sorttable table(names char(10))After creating the table we insert the data into table we created above.
insert into @sorttable select 'bhaskar' union all select 'siva' union all select 'krishna' union all select 'anil'Now to sort the above data we use the following statement
select names from @sorttable order by left(names,1)
No comments:
Post a Comment