Link to home
Start Free TrialLog in
Avatar of computerstreber
computerstreberFlag for United States of America

asked on

Update Random Rows

To select random records, you can execute:

SELECT TOP 10 *
FROM Products
WHERE ProductName = 'bike'
ORDER BY NEWID()

Now, what I want to do is incorporate the above syntax in an update statement. For example, I want to randomly select 10 rows from a table that meet one condition and then update a column with a value in each of those ten rows. Plus, I want to send to a text file to my C drive with the 10 random rows that were updated. Is this possible?
SOLUTION
Avatar of Jinesh Kamdar
Jinesh Kamdar
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Anthony Perkins
Anthony Perkins
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of computerstreber

ASKER

Great Answers
>>Just curious though, is there a way to use NewID() within a DAO.Recordset without having to use a pass through query <<
I am afraid I have no idea.

>>It just seemed that given the authors desire to update the 10 random records sent and transfer that data to a file that Access via an ODBC connection offered the simplest solution.<<
DTS can be used for this purpose, without the need for MS Access.