{"id":188,"date":"2024-03-13T18:06:29","date_gmt":"2024-03-13T16:06:29","guid":{"rendered":"http:\/\/130.61.57.200\/?p=188"},"modified":"2024-03-13T18:06:29","modified_gmt":"2024-03-13T16:06:29","slug":"sequence-referenced-by-table","status":"publish","type":"post","link":"http:\/\/130.61.57.200\/index.php\/2024\/03\/13\/sequence-referenced-by-table\/","title":{"rendered":"Sequence referenced by table"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Find which table references a sequence qith the following statement:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>SELECT s.object_id AS sequence_object_id,&lt;br&gt;s.name AS sequence_name,&lt;br&gt;OBJECT_SCHEMA_NAME(o.parent_object_id) + &#039;.&#039;&lt;br&gt;+ OBJECT_NAME(o.parent_object_id) AS table_name,&lt;br&gt;r.*&lt;br&gt;FROM sys.sequences s&lt;br&gt;CROSS APPLY sys.dm_sql_referencing_entities(&lt;br&gt;OBJECT_SCHEMA_NAME(s.object_id) + &#039;.&#039; + s.name,&lt;br&gt;&#039;OBJECT&#039;&lt;br&gt;) r&lt;br&gt;JOIN sys.objects o&lt;br&gt;ON o.object_id = r.referencing_id<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Find which table references a sequence qith the following statement: SELECT s.object_id AS sequence_object_id,&lt;br&gt;s.name AS sequence_name,&lt;br&gt;OBJECT_SCHEMA_NAME(o.parent_object_id) + &#039;.&#039;&lt;br&gt;+ OBJECT_NAME(o.parent_object_id) AS table_name,&lt;br&gt;r.*&lt;br&gt;FROM sys.sequences s&lt;br&gt;CROSS APPLY sys.dm_sql_referencing_entities(&lt;br&gt;OBJECT_SCHEMA_NAME(s.object_id) + &#039;.&#039; + s.name,&lt;br&gt;&#039;OBJECT&#039;&lt;br&gt;) r&lt;br&gt;JOIN sys.objects o&lt;br&gt;ON o.object_id = r.referencing_id<\/p>\n","protected":false},"author":1,"featured_media":104,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-188","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-mssql"],"blocksy_meta":[],"_links":{"self":[{"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/posts\/188","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/comments?post=188"}],"version-history":[{"count":1,"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/posts\/188\/revisions"}],"predecessor-version":[{"id":189,"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/posts\/188\/revisions\/189"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/media\/104"}],"wp:attachment":[{"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/media?parent=188"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/categories?post=188"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/tags?post=188"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}