Guest User

Untitled

a guest
Mar 17th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. select
  2. u.name,
  3. o.name,
  4. case (o.type) when 'S' then 'SYSTEM TABLE' else 'TABLE' end,
  5. (select convert(varchar(8000), value) from ::fn_listextendedproperty(NULL, 'user', u.name, 'table', o.name, null, null) where name = 'MS_Description') as coln
  6. from
  7. sys.sysobjects o
  8. join sys.schemas u on (u.schema_id = o.uid)
  9. where
  10. o.type in ('U', 'S')
  11. and u.name = "something here"
  12. order by 1, 2
  13.  
  14. SQLSTATE = 42000, Microsoft SQL Native Client, Incorrect Syntax near ā€˜uā€™
  15.  
  16. select
  17. u.name,
  18. o.name,
  19. case (o.type) when 'S' then 'SYSTEM TABLE' else 'TABLE' end,
  20. convert(varchar(8000), ex.value) as coln
  21. from
  22. [%CATALOG%.]sys.sysobjects o
  23. join [%CATALOG%.]sys.schemas u on (u.schema_id = o.uid)
  24. cross apply ::fn_listextendedproperty(NULL, 'user', u.name, 'table', o.name, null, null) ex
  25. where
  26. o.type in ('U', 'S')
  27. [ and u.name = %.q:OWNER%]
  28. and ex.name = 'MS_Description'
  29. order by 1, 2
  30.  
  31. [ and u.name = %.q:OWNER%]
Add Comment
Please, Sign In to add comment