I am new to SQL. I have a table in an SQL server 2012.
- ItemReviewId column is the PK.
- Deleted column will have only "yes" and "No" value.
- Audited column will have only "Yes" and "No" value.
I want to create a stored procedure to do the followings:
- Pick a random sample of 5% for 'Deleted' "Yes" and '5% for 'Deleted' "No" for distinct 'UserId' and distinct 'ReviewDate' in a given date range. Audited ="Yes" will be excluded from the sample.
- Update Audited to "Check"
- Update AssignedTo to "jsmith"
How can I achieve this?
Any help would be highly appreciated. Thanks in advance.