Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. Shelby500

    UPDATE multiple items in JOIN

    So an UPDATE query cannot be used to update two tables? UPDATEs can only be used to update one table and anything over one table has to use a MERGE?
  2. Shelby500

    UPDATE multiple items in JOIN

    Can someone tell me why this is allowed: update (select su.sec_usr_id,su.is_enbl_ind,t.asn_usr_id,t.stat_typ_cd,su.lst_updt_dt from sec_usr su, tsk t where su.is_enbl_ind = 0 and su.sec_usr_id = t.asn_usr_id and t.stat_typ_cd = 'OPEN')u set u.stat_typ_cd = 'CLOSED'; but this is not...
  3. Shelby500

    UPDATE that uses DISTINCT

    Sorry, one more question. The DBA gave me this below but to me it looks like it finds the unique sec_usr_id's and then updates the stat_typ_cd. Isn't this way pretty inefficient to use? This is my last question and then I'm going to get a cup of coffee and bang my head against the wall. His...
  4. Shelby500

    UPDATE that uses DISTINCT

    [curse][hairpull] You guys are correct. Too much time staring at a computer screen I guess. lol [thanks2]
  5. Shelby500

    UPDATE that uses DISTINCT

    I have been working on an UPDATE query that will update one column based on results from a join select query. [highlight #FCE94F]I am looking to update the column "stat_typ_cd='OPEN'" to "stat_typ_cd='CLOSED'".[/highlight] At the bottom of the page is the SELECT query that pulls the data that...
  6. Shelby500

    Format Date for SQL query

    Just a note for anyone that uses this thread in the future. The timer function works great but if you are going to use another app to schedule the script then it is unesscessary. I used the code below to just subtract 30 minutes from the date/time in order to get my variables for my SQL query. I...
  7. Shelby500

    Format Date for SQL query

    I figured it out. I was running the script every 15 minutes and the timer was set to every 30 minutes (1800). Once I changed the interval the script runs it sorted itself out. I also had to change the "n" of the datepart to be "-15" to ensure it was not checking for a date that didn't exist yet...
  8. Shelby500

    Format Date for SQL query

    Geates, I've had a hard time adjusting the timer part of the code to just do the last 30 minutes of data. The time change really messed it up since it is Pacific time zone and the database it pulls from is central time. I will assume there really isn't a way to automatically adjust for the time...
  9. Shelby500

    Format Date for SQL query

    Got it.....uppercase HH. Makes sense.
  10. Shelby500

    Format Date for SQL query

    @strongm - How do you get your funcion to use 24 hour format rather than 12 hour?
  11. Shelby500

    Format Date for SQL query

    I hate to keep this thread going but I seem to have an issue with this part of code. The script seemed to be working fine but now it is sending the email saying that the data is empty. I checked it and it is hitting the code below. If I try to remove the code it gives an error saying that BOF or...
  12. Shelby500

    Format Date for SQL query

    Just so the thread isn't left unfinished. Here is the final script in all its glory. Thanks again PHV and Geates. If you see anything wrong or code that can be improved please let me know. I'm a newbie and appreciate all of the insight. Dim strCon Dim SQLArray theDate = date() newDate =...
  13. Shelby500

    Format Date for SQL query

    One more question. Should I start the For Loop at 1 rather than 0 or does that make any difference since I am getting the correct SUM now?
  14. Shelby500

    Format Date for SQL query

    Here is PHV's. It returns 10 about six times. This is actually the correct SUM. Thanks PHV and Geates for all the help. for i = 0 to ubound(SQLArray,2) wscript.echo sum(SQLArray) If sum(SQLArray) = 0 then ....code here.... Wscript.quit else strRows = strRows & "<TR...
  15. Shelby500

    Format Date for SQL query

    Ok, here is what I have right now. It is returning the number 20 in an endless loop. for i = 0 to ubound(SQLArray,2) wscript.echo sum(SQLArray,0) If sum(SQLArray,0) = 0 then ....code here.... Wscript.quit else strRows = strRows & "<TR style=WORD-BREAK:BREAK-ALL;><TD NOWRAP><center>" &...
  16. Shelby500

    Format Date for SQL query

    Changing it to 1 on the for loop didn't help. It still says type mismatch. So far none of the functions are working.
  17. Shelby500

    Format Date for SQL query

    Well...it contains the count. I would assume that SQL creates numbers when it does a count, correct? Below is an example output. It also works for SQLArray(0,i) and SQLArray(1,i) but not for SQLArray(2,i). TO_CHAR(LG.LOGTIME,'HH24') TO_CHAR(LG.LOGTIME,'MI') COUNT 10 15 1 10 19 2...
  18. Shelby500

    Format Date for SQL query

    For some reason I get a type mismatch on sum = sum + SQLArray(2,i)
  19. Shelby500

    Format Date for SQL query

    Also, shouldn't it be sum(SQLArray,2) rather than sum(SQLArray,0) since we are looking at the 3rd column in the array?
  20. Shelby500

    Format Date for SQL query

    If I remove the sum=0 or sum=-1 altogether it returns the correct number but it returns it 3 times. So rather than returning 10 it returns 101010.

Part and Inventory Search

Back
Top