Professional Web Applications Themes

Triggers & Inserted Data Length... - Microsoft SQL / MS SQL Server

Is it possible to get the value of the length of data being inserted into a table by using a trigger? What I'm looking to do is keep track of how much database space a user is using so I was thinking of tracking the amount of data being added to the tables using a trigger (which would update their grand total in a different table). Thanks....

  1. #1

    Default Triggers & Inserted Data Length...

    Is it possible to get the value of the length of data being inserted into a
    table by using a trigger?

    What I'm looking to do is keep track of how much database space a user is
    using so I was thinking of tracking the amount of data being added to the
    tables using a trigger (which would update their grand total in a different
    table).

    Thanks.


    Greg Guest

  2. #2

    Default Re: Triggers & Inserted Data Length...

    You can run sp_spaceused < tablename> and put the output in another table

    "Greg" <com> wrote in message
    news:u6ma$phx.gbl... 

    different 


    Partha Guest

  3. #3

    Default Triggers & Inserted Data Length...

    You mean something like

    create trigger tr on tbl for insert
    as
    update tottbl
    set NoBytes = NoBytes + (select sum(coalesce(datalength
    (fld),0))
    from inserted)
    go

     
    being inserted into a 
    space a user is 
    being added to the 
    total in a different 
    Nigel Guest

Similar Threads

  1. Ordered Data Inserted into TEMP table, is Read out in Different ORDER??
    By RKD in forum Microsoft SQL / MS SQL Server
    Replies: 5
    Last Post: August 5th, 06:04 AM
  2. #40337 [NEW]: Data inserted by other application NOT ACCESSABLE
    By R_de__R at hotmail dot com in forum PHP Bugs
    Replies: 1
    Last Post: February 5th, 09:49 AM
  3. Question on triggers and special 'deleted' 'inserted' tables
    By Zig Mandel in forum Microsoft SQL / MS SQL Server
    Replies: 1
    Last Post: July 9th, 10:04 PM
  4. Triggers and importing data once again
    By Przemo in forum Microsoft SQL / MS SQL Server
    Replies: 2
    Last Post: July 6th, 04:53 PM
  5. Triggers and importing data
    By Przemo in forum Microsoft SQL / MS SQL Server
    Replies: 4
    Last Post: July 6th, 02:25 PM

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