Alkannetworks
asked on
MS SQL Server MGMT Express
Dear
I need your help . I have attendance application run on MS SQL express and i need to get all transactions that recorded in PM (TRANS_TIME) to Change it be ( Out) transactions and all AM in(TRANS_TIME) to be changed to (IN ) , as i have many transactions recorded wrong on the system .
Note:
IN = 0 ( in TRANS_TYPE_ID) column in DB
OUT=1 ( in TRANS_TYPE_ID) column in DB
1.jpg
I need your help . I have attendance application run on MS SQL express and i need to get all transactions that recorded in PM (TRANS_TIME) to Change it be ( Out) transactions and all AM in(TRANS_TIME) to be changed to (IN ) , as i have many transactions recorded wrong on the system .
Note:
IN = 0 ( in TRANS_TYPE_ID) column in DB
OUT=1 ( in TRANS_TYPE_ID) column in DB
1.jpg
E.g.
WHERE HOUR(trans_time) < 12
ASKER
Dears
Can u help me in writing the complete right code
Can u help me in writing the complete right code
ASKER
let me correct my question , how i can select just all transactions in PM or in AM so i can select trasntype_id and change it manual to in or out transactions
thnks
thnks
What is the problem? Take your code and complete it:
Update tablename set transtypeid =0
WHERE HOUR(trans_time) < 12
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
hmm, sry, meant DATEPART(HOUR, trans_time) < 12..
ASKER
no one gives me complete correct answer
That's right, we give assistance and guidance not a "complete correct answer" that you can just paste right in and use. If you are going to expect us to do all the work for you, at least setup a sqlfiddle but know that many of the experts including myself will not just do the work, we offer guidance.
ASKER
Ok , I know that , I am Just not familiar with SQL , and for sure I didn't mean that to find someone to do my work .
Thanks
Thanks
Update tablename set transtypeid =0 where convert(trans_time to 24 hour) < 12
Then the reverse for >= 12 is PM