How to display random 5 images from the database?

Posted by .Netlearner under Sql Server on 6/11/2012 | Points: 10 | Views : 5176 | Status : [Member] | Replies : 2
Hello All,
In ASP.NEt i have to display the random 5 images.Each time i display the page i want 5 random images to be displayed ! Am using SQL Server 2008 as back end. How to select the random 5 image file path from the database.(i have stored image path with the type varchar(100))




Responses

Posted by: Ajay.Kalol on: 6/11/2012 [Member] Starter | Points: 25

Up
0
Down
SELECT TOP 5 IMGPath FROM Table ORDER BY NEWID()



This will give you random Path.

Ajay
ajaypatelfromsanthal.blogspot.in

.Netlearner, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Muhsinathk on: 6/15/2012 [Member] Bronze | Points: 25

Login to post response