computerstreber
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?
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>>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.
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.
ASKER