Converting from Access to MSSQL - rnd function

Posted on 2005-03-08
Medium Priority
Last Modified: 2008-02-26
I am converting this code from Access to MSSQL,

I have an error that reads:

Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]'rnd' is not a recognized function name.

The code says:

strSQL = "SELECT * FROM [feedback] WHERE feedbackstatus = 'show' ORDER BY rnd(-(1000*dc_feedbackKey)* " & R & ")"

It randomizes the set of records.
Anyone know how to write this out for MSSQL?

Also is there an online reference for comparrissons between Access, MSSQL, and MYSQL for ASP code?

Question by:Insomniac_PhD
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
LVL 46

Expert Comment

ID: 13489700

You need to use ROUND(X) , ROUND(X,D)

LVL 46

Expert Comment

ID: 13489734
Unless you want random, which is:

RAND() , RAND(N) <--N is the seed

LVL 46

Accepted Solution

fritz_the_blank earned 2000 total points
ID: 13489821
so, perhaps this?

strSQL = "SELECT * FROM [feedback] WHERE feedbackstatus = 'show' ORDER BY RAND(-(1000*dc_feedbackKey)* " & R & ")"


Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question