Get the Record from Update Column in SQL Server - sql

I want to ask about SQL Server. I have some column Point. With every purchase of something, this point value will increase.
For example: the first serial account 100 has purchased MILK, then Point goes from 50 to 75.
The problem is, can I get the record from update Point column if first 50 become to 75 with trigger then will write to new column, like PointLog?
Thanks in advance and sorry for my bad English..

Related

Query to view the date and time a row was last updated for table without having an existing trigger\mechanism?

I'm sure this is going to be a hard no, but I have a table that I need to know the last update date and time for one particular row, written in the past.
Is there a way to find this information? Maybe a system column that accompanies every row that the rdbms writes by default but not visible to users? Or do we need to create a trigger\procedure to record this information on a table-by-table basis BEFORE records are written? Googling only suggests that this is the case.
I don't have DBA access and can't get it btw.
SQL Server Management Studio v18.1
You are right, if you have not taken any steps to record this info then it is unavailable to you. – Dale K Dec 10 at 1:56

Macro that deletes duplicates given particular parameters

Let's say I am given a data sheet with executed trades. The problem is that each trade is given a buy side and a sell side which duplicates the information I want to analyze. The commonality amongst the duplicates is that they have the same order number. Example:
**Order Number** **Side**
20 Buy
20 Sell
25 Buy
30 Sell
30 Buy
25 Sell
Initially I thought of using "Remove Duplicates" but that does not delete the entire row and rather just the cell. How can I create a macro that Searches the order number column for duplicates and if they are found --> one row is deleted?
Instead of using VBA, you can actually just use "Remove Duplicates" by simply selecting the column that you want to use to delete the rows.
You can find a great explanation about how to do this here:
https://www.extendoffice.com/documents/excel/3421-excel-delete-rows-based-on-duplicates-in-one-column.html

MS Access Combo Box Selections and Time Calculation

Hi currently i am making a Table with 21 Columns ("Task, Name, Time Taken") Each group, so total 7 groups.
Task combo consist of "WIP, HOLD, Quality Check"
Name combo consist of "Mark, John, Alex"
Time taken is a number field "only minutes" like 150, 200, 300 etc
At the end i have 3 columns which is for total time taken for "WIP, HOLD, Quality Check"
My Requirements:
a) When i select a Task (eg. WIP) auto the name should block with the user logged in "I have created a employee table with login form its working fine"
b) When the task selected as "WIP" and entered the "Time Taken" may be multipal times wit there groups. only the WIP total time should calculate and reflect on "TOTAL TIME TAKEN for WIP column"
Please help me ... it may be confusing but let me know if your unable to understand.
Thanks in advance.
What you're describing doesn't sound normalized at all. I'm not entirely clear on your situation but I believe you need to have two at least two tables. If you don't know what normalization is then
What is Normalisation (or Normalization)?
is a good place to start
As for the last 3 columns with the total time. You shouldn't put that in a table. Once you have a table you should always have a query total it up for you.
First of all, your table should have 5 columns. ID, Task, Name, TimeTaken, GroupName. Unless you have a need to show 7 groups simultaneously on the same form? You can filter the data at any time based on GroupName.
For part a, it sounds like your login form should be able to feed your Name combo? Just set ComboName.SelectedValue to whatever your user's name is.
For part b, I just don't understand what you're asking. Can you clarify?

SQL query in Access

Basically, I've been trying to make this query work for a while in Access and it's really frustrating me so instead of playing around with the criteria, I've decided to just do it in SQL instead but I can't quite figure out how to do this bit.
What I need to do is create a query that shows which members haven't returned an item that they're currently taking out on loan. If possible I'd like to include a calculated field to state the date is was due back and how many days late it is.
The fields I'm using are as follows;
Table = Loan
Toy Name
Hire Date
Duration (in days)
Returned Date (if it hasn't been returned, the cell is blank)
Table = Toy
Purchase Price
Hire Price
you wrote:
a query that shows which members haven't returned an item
your table does not have members in it. secondly table toy have nothing related to toy like toy name or something. Please provide further detail of tables.
one more question what is the meaning of blank? Is it Null or blank string?

SQL Update query not completed

I made a SQL query to update registers on a table. The table has about 15 million registers. The update statement is like:
UPDATE temp_conafe
set apoyo = trim(apoyo)
where cve_status like '%APOYO%';
I keep checking the field v$transaction.used_ured to see if the query is rolling forward or backwards but when the number of records reach to more than 15 millions the query starts rolling backwards.
How do I get the update to complete successfully?
I'm not the DBA, just a programmer, but I can't keep developing till that thing updates my registers.
It looks as if your transaction is to big. Try to add another limiting clause in the where. If you have a Id field you can add something like this:
where cve_status like '%APOYO%'
AND id > 1 AND id < 100000
You need to run it multiple times an change the range accordingly. If this is not an option you have to talk to your DBA and ask him to give you more resources.