G2A Many GEOs
SHARE
TWEET

refresh_SSMS_Database_Node.sql

a guest Apr 6th, 2015 189 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. EXEC sp_executesql N'SELECT
  2. clmns.name AS [Name],
  3. clmns.column_id AS [ID],
  4. clmns.is_nullable AS [Nullable],
  5. clmns.is_computed AS [Computed],
  6. CAST(ISNULL(cik.index_column_id, 0) AS bit) AS [InPrimaryKey],
  7. clmns.is_ansi_padded AS [AnsiPaddingStatus],
  8. CAST(clmns.is_rowguidcol AS bit) AS [RowGuidCol],
  9. CAST(ISNULL(COLUMNPROPERTY(clmns.object_id, clmns.name, N''IsDeterministic''),0) AS bit) AS [IsDeterministic],
  10. CAST(ISNULL(COLUMNPROPERTY(clmns.object_id, clmns.name, N''IsPrecise''),0) AS bit) AS [IsPrecise],
  11. CAST(ISNULL(cc.is_persisted, 0) AS bit) AS [IsPersisted],
  12. ISNULL(clmns.collation_name, N'''') AS [Collation],
  13. CAST(ISNULL((select TOP 1 1 from sys.foreign_key_columns AS colfk where colfk.parent_column_id = clmns.column_id and colfk.parent_object_id = clmns.object_id), 0) AS bit) AS [IsForeignKey],
  14. clmns.is_identity AS [Identity],
  15. CAST(ISNULL(ic.seed_value,0) AS bigint) AS [IdentitySeed],
  16. CAST(ISNULL(ic.increment_value,0) AS bigint) AS [IdentityIncrement],
  17. (case when clmns.default_object_id = 0 then N'''' when d.parent_object_id > 0 then N'''' else d.name end) AS [Default],
  18. (case when clmns.default_object_id = 0 then N'''' when d.parent_object_id > 0 then N'''' else schema_name(d.schema_id) end) AS [DefaultSchema],
  19. (case when clmns.rule_object_id = 0 then N'''' else r.name end) AS [Rule],
  20. (case when clmns.rule_object_id = 0 then N'''' else schema_name(r.schema_id) end) AS [RuleSchema],
  21. ISNULL(ic.is_not_for_replication, 0) AS [NotForReplication],
  22. CAST(COLUMNPROPERTY(clmns.object_id, clmns.name, N''IsFulltextIndexed'') AS bit) AS [IsFullTextIndexed],
  23. CAST(clmns.is_filestream AS bit) AS [IsFileStream],
  24. CAST(clmns.is_sparse AS bit) AS [IsSparse],
  25. CAST(clmns.is_column_set AS bit) AS [IsColumnSet],
  26. usrt.name AS [DataType],
  27. s1clmns.name AS [DataTypeSchema],
  28. ISNULL(baset.name, N'''') AS [SystemType],
  29. CAST(CASE WHEN baset.name IN (N''nchar'', N''nvarchar'') AND clmns.max_length <> -1 THEN clmns.max_length/2 ELSE clmns.max_length END AS int) AS [Length],
  30. CAST(clmns.precision AS int) AS [NumericPrecision],
  31. CAST(clmns.scale AS int) AS [NumericScale],
  32. ISNULL(xscclmns.name, N'''') AS [XmlSchemaNamespace],
  33. ISNULL(s2clmns.name, N'''') AS [XmlSchemaNamespaceSchema],
  34. ISNULL( (case clmns.is_xml_document when 1 then 2 else 1 end), 0) AS [XmlDocumentConstraint],
  35. CASE WHEN usrt.is_table_type = 1 THEN N''structured'' ELSE N'''' END AS [UserType]
  36. FROM
  37. sys.all_views AS v
  38. INNER JOIN sys.all_columns AS clmns ON clmns.object_id=v.object_id
  39. LEFT OUTER JOIN sys.indexes AS ik ON ik.object_id = clmns.object_id and 1=ik.is_primary_key
  40. LEFT OUTER JOIN sys.index_columns AS cik ON cik.index_id = ik.index_id and cik.column_id = clmns.column_id and cik.object_id = clmns.object_id and 0 = cik.is_included_column
  41. LEFT OUTER JOIN sys.computed_columns AS cc ON cc.object_id = clmns.object_id and cc.column_id = clmns.column_id
  42. LEFT OUTER JOIN sys.identity_columns AS ic ON ic.object_id = clmns.object_id and ic.column_id = clmns.column_id
  43. LEFT OUTER JOIN sys.objects AS d ON d.object_id = clmns.default_object_id
  44. LEFT OUTER JOIN sys.objects AS r ON r.object_id = clmns.rule_object_id
  45. LEFT OUTER JOIN sys.types AS usrt ON usrt.user_type_id = clmns.user_type_id
  46. LEFT OUTER JOIN sys.schemas AS s1clmns ON s1clmns.schema_id = usrt.schema_id
  47. LEFT OUTER JOIN sys.types AS baset ON (baset.user_type_id = clmns.system_type_id and baset.user_type_id = baset.system_type_id) or ((baset.system_type_id = clmns.system_type_id) and (baset.user_type_id = clmns.user_type_id) and (baset.is_user_defined = 0) and (baset.is_assembly_type = 1))
  48. LEFT OUTER JOIN sys.xml_schema_collections AS xscclmns ON xscclmns.xml_collection_id = clmns.xml_collection_id
  49. LEFT OUTER JOIN sys.schemas AS s2clmns ON s2clmns.schema_id = xscclmns.schema_id
  50. WHERE
  51. (clmns.name=@_msparam_0)and((v.type = @_msparam_1)and(v.name=@_msparam_2 and SCHEMA_NAME(v.schema_id)=@_msparam_3))',N'@_msparam_0 nvarchar(4000),@_msparam_1 nvarchar(4000),@_msparam_2 nvarchar(4000),@_msparam_3 nvarchar(4000)',@_msparam_0=N'is_cdc_enabled',@_msparam_1=N'V',@_msparam_2=N'databases',@_msparam_3=N'sys'
RAW Paste Data
Ledger Nano X - The secure hardware wallet
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top