Advertisement
Guest User

Untitled

a guest
May 28th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 0.70 KB | None | 0 0
  1. SET QUOTED_IDENTIFIER ON
  2. GO
  3. SET ANSI_NULLS ON
  4. GO
  5.  
  6. Create Procedure FindRowLength ( @TabName VarChar(100) = '' )
  7. As
  8. Begin
  9. set nocount on
  10. If @TabName = ''
  11. Begin
  12.     SELECT  o.name, Sum( C.length ) As rowLength from
  13.         sysobjects o
  14.         INNER JOIN
  15.             sysColumns C
  16.     ON  o.id = C.id
  17.     WHERE   (o.xtype = 'u') AND (o.type = 'u')
  18.     Group by o.name
  19.     ORDER BY o.name
  20. End
  21. Else
  22. Begin
  23.     SELECT  o.name, Sum( C.length ) As rowLength from
  24.         sysobjects o
  25.         INNER JOIN
  26.             sysColumns C
  27.     ON  o.id = C.id
  28.     WHERE   (o.xtype = 'u') AND (o.type = 'u')  and o.name = @TabName
  29.     Group by o.name
  30.     ORDER BY o.name
  31. End
  32. End
  33.  
  34. GO
  35. SET QUOTED_IDENTIFIER OFF
  36. GO
  37. SET ANSI_NULLS ON
  38. GO
  39.  
  40. execute FindRowLength
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement