Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
frank.svs
Constraint Violating Yak Guru
368 Posts |
Posted - 2007-03-13 : 05:20:23
|
| Hi pals,I need a small help.I have the following table.create table test( empno int, name varchar(10), sal int )select * from test101 frank 9999102 alex 7777103 raj 6666104 sam 3333105 tarun 1111106 bobby 2222107 jack 1234108 sharat 2888109 ram 9193110 santhosh 3939Now i need to write a stored procedure.Each time when i execute the stored procedure it should able to return 3 random recs from the table each and every time i try to execute the stored procedure. How can i do that. Can anyone plz help me.Thanks in advance,franky |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-03-13 : 07:48:24
|
[code]select top 3 * from test order by newid()[/code] KH |
 |
|
|
|
|
|