Professional Web Applications Themes

SQL Server Stored procedure - Coldfusion Database Access

I want to write a stored procedure to get result like this....how can i do?. Result needed from stored procedure....... lastname,firstname,logout_time,activity,score,pass/fail Queries inside the stored procedure....... select b.lastname,b.firstname, a.user_id,a.login_time, a.logout_time from activity_log a, users b where a.activity_id = b.user_id group by user_id,lastname,firstname,login_time,logout_time select activity from activity_log where user_id = 'a.user_id' and activity is not NULL select sum(convert(int,correct,1)) as score from activity_log where user_id = a.user_id if score gt 50 pass else fail...

  1. #1

    Default SQL Server Stored procedure

    I want to write a stored procedure to get result like this....how can i do?.

    Result needed from stored procedure.......
    lastname,firstname,logout_time,activity,score,pass/fail


    Queries inside the stored procedure.......
    select b.lastname,b.firstname,
    a.user_id,a.login_time, a.logout_time
    from activity_log a, users b
    where a.activity_id = b.user_id
    group by user_id,lastname,firstname,login_time,logout_time


    select activity
    from activity_log
    where user_id = 'a.user_id' and activity is not NULL


    select sum(convert(int,correct,1)) as score
    from activity_log
    where user_id = a.user_id


    if score gt 50
    pass
    else
    fail

    Adomacro Guest

  2. #2

    Default Re: SQL Server Stored procedure help needed

    Adomacro,

    Your question is not stated clearly. Posting your table structure and clarifying what you're trying to accomplish might help. Please also provide the name and version of your DBMS.
    JR Guest

  3. #3

    Default Re: SQL Server Stored procedure help needed

    Thanks

    SQL Server 2000.

    Please see my tables...
    select activity_id ,login_time,logout_time,q_id,r_id,correct,activity
    from activity_log

    select user_id,firstname,lastname
    from users
    Adomacro Guest

Similar Threads

  1. SQL Server Stored Procedure Authentication
    By airnewhouse in forum Coldfusion Database Access
    Replies: 2
    Last Post: June 9th, 09:19 PM
  2. RecordCount with Stored Procedure in SQL Server
    By Ken VdB in forum ASP Database
    Replies: 8
    Last Post: October 21st, 03:01 PM
  3. Legacy ASP, SQL Server, Paging Stored Procedure - resend
    By Bob Barrows in forum ASP Database
    Replies: 1
    Last Post: September 30th, 05:36 PM
  4. Replies: 3
    Last Post: July 21st, 07:11 PM
  5. Stored procedure help, makes server jump to 100%
    By Luis in forum Microsoft SQL / MS SQL Server
    Replies: 3
    Last Post: July 1st, 01:45 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139