Link to home
Start Free TrialLog in
Avatar of Alkannetworks
AlkannetworksFlag for Egypt

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
Avatar of Aaron Tomosky
Aaron Tomosky
Flag of United States of America image

i can't write pastable sql code on my mobile, but here is a high level psudosql
Update tablename set transtypeid =0 where convert(trans_time to 24 hour) < 12

Then the reverse for >= 12 is PM
E.g.
WHERE HOUR(trans_time) < 12

Open in new window

Avatar of Alkannetworks

ASKER

Dears
Can u help me in writing the complete right code
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
What is the problem? Take your code and complete it:

Update tablename set transtypeid =0
WHERE HOUR(trans_time) < 12

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Alkannetworks
Alkannetworks
Flag of Egypt 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
hmm, sry, meant DATEPART(HOUR, trans_time) < 12..
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.
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