Skip to main content
added 280 characters in body
Source Link
starball
  • 26.8k
  • 8
  • 52
  • 129
  • Id
  • PostId
  • PostNoticeTypeId
    1 = Citation needed
    2 = Current event
    3 = Insufficient explanation
    10 = Current answers are outdated
    11 = Draw attention
    12 = Improve details
    13 = Authoritative reference needed
    14 = Canonical answer required
    15 = Reward existing answer
    20 = Content dispute
    21 = Offtopic comments
    22 = Historical significance
    23 = Wiki Answer
    24 = Policy Lock (SO Collectives)
    25 = Recommended Answer (SO Collectives)
    26 = Posted by Recognized Member/Admin (SO Collectives)
    27 = Endorsed Edit (SO Collectives)
    28 = Obsolete (SO Collectives)
    1000 = Redditted (SO)
    9001 = DCMA Takedown
  • CreationDate
  • DeletionDate
  • ExpiryDate
  • Body (when present contains the custom text shown with the notice)
  • OwnerUserId
  • DeletionUserId
  • Id
  • PostId
  • PostNoticeTypeId
    1 = Citation needed
    2 = Current event
    3 = Insufficient explanation
    10 = Current answers are outdated
    11 = Draw attention
    12 = Improve details
    13 = Authoritative reference needed
    14 = Canonical answer required
    15 = Reward existing answer
    20 = Content dispute
    21 = Offtopic comments
    22 = Historical significance
    23 = Wiki Answer
  • CreationDate
  • DeletionDate
  • ExpiryDate
  • Body (when present contains the custom text shown with the notice)
  • OwnerUserId
  • DeletionUserId
  • Id
  • PostId
  • PostNoticeTypeId
    1 = Citation needed
    2 = Current event
    3 = Insufficient explanation
    10 = Current answers are outdated
    11 = Draw attention
    12 = Improve details
    13 = Authoritative reference needed
    14 = Canonical answer required
    15 = Reward existing answer
    20 = Content dispute
    21 = Offtopic comments
    22 = Historical significance
    23 = Wiki Answer
    24 = Policy Lock (SO Collectives)
    25 = Recommended Answer (SO Collectives)
    26 = Posted by Recognized Member/Admin (SO Collectives)
    27 = Endorsed Edit (SO Collectives)
    28 = Obsolete (SO Collectives)
    1000 = Redditted (SO)
    9001 = DCMA Takedown
  • CreationDate
  • DeletionDate
  • ExpiryDate
  • Body (when present contains the custom text shown with the notice)
  • OwnerUserId
  • DeletionUserId
added new views and sp for cross-site queries, details from https://meta.stackexchange.com/a/399304 and https://meta.stackexchange.com/a/398996
Source Link
rene
  • 91.1k
  • 17
  • 241
  • 511

Views / Stored Procedures

To support queries across multiple databases (aka sites) the following views and stored procedure exist in each database. See Create a view that provides a list of databases for usage scenarios.


sede_databases

  • database_id
  • database_name
  • site_name
  • tiny_name
  • long_name
  • site_type main_site or meta_site
  • site_url
  • sede_url
  • api_site_parameter
  • initialized Datetime when we started populating that database.
  • made_available Datetime when the database came online and was ready for queries
  • processing_time The duration between initialized and made_available, in hh:mm:ss.fff format
  • questions Total number of questions in this site at the time of the current refresh
  • answers Total number of answers in this site at the time of the current refresh
  • latest_post The timestamp of the last post captured in this refresh
  • notes This will be non-NULL when a database is in transition

sede_databases_markdown

  • rn row number, for sorting by "long name"
  • content markdown with headers

sede_tables

  • database_id from sys.databases
  • database_name from sys.databases
  • table_name from sys.tables
  • latest_date The latest timestamp (e.g. CreationDate) for tables that have such a column.
  • row_count Number of rows in the table, according to sys.partitions. Note: For Posts, this is PostsWithDeleted; if you want non-deleted total number of Posts, use answers + questions from dbo.sede_databases
  • initialized Timestamp of initial table creation
  • made_available Timestamp of final operation against table.
  • processing_time Duration of initialized -> made_available, in {hh:mm:ss.fff} format.

sede_sites

  • site_name
  • site_url
  • database_name
  • long_name
  • site_id

sede_users

  • account_id
  • site_id
  • user_id
  • reputation
  • question_count
  • answer_count

sede_ineachdb

note: this is a stored procedure!

See this answer for usage details.

ParameterData TypeDefaultDescription
@SQLCommandnvarchar(4000)The SQL statement to run
@IncludeMainSitesbit1Include all non-meta sites
@IncludeMetaSitesbit1Include all meta sites
@IncludeMainMetabit1Include StackExchange.Meta
@CollectResultsForMebit1For standard SELECT queries, this will attempt to put each database's results into a #temp table
@ErrorOnSkippedSitesbit0Set this to 1 if you want execution to halt in the event any site is missing due to transition change

Views / Stored Procedures

To support queries across multiple databases (aka sites) the following views and stored procedure exist in each database. See Create a view that provides a list of databases for usage scenarios.


sede_databases

  • database_id
  • database_name
  • site_name
  • tiny_name
  • long_name
  • site_type main_site or meta_site
  • site_url
  • sede_url
  • api_site_parameter
  • initialized Datetime when we started populating that database.
  • made_available Datetime when the database came online and was ready for queries
  • processing_time The duration between initialized and made_available, in hh:mm:ss.fff format
  • questions Total number of questions in this site at the time of the current refresh
  • answers Total number of answers in this site at the time of the current refresh
  • latest_post The timestamp of the last post captured in this refresh
  • notes This will be non-NULL when a database is in transition

sede_databases_markdown

  • rn row number, for sorting by "long name"
  • content markdown with headers

sede_tables

  • database_id from sys.databases
  • database_name from sys.databases
  • table_name from sys.tables
  • latest_date The latest timestamp (e.g. CreationDate) for tables that have such a column.
  • row_count Number of rows in the table, according to sys.partitions. Note: For Posts, this is PostsWithDeleted; if you want non-deleted total number of Posts, use answers + questions from dbo.sede_databases
  • initialized Timestamp of initial table creation
  • made_available Timestamp of final operation against table.
  • processing_time Duration of initialized -> made_available, in {hh:mm:ss.fff} format.

sede_sites

  • site_name
  • site_url
  • database_name
  • long_name
  • site_id

sede_users

  • account_id
  • site_id
  • user_id
  • reputation
  • question_count
  • answer_count

sede_ineachdb

note: this is a stored procedure!

See this answer for usage details.

ParameterData TypeDefaultDescription
@SQLCommandnvarchar(4000)The SQL statement to run
@IncludeMainSitesbit1Include all non-meta sites
@IncludeMetaSitesbit1Include all meta sites
@IncludeMainMetabit1Include StackExchange.Meta
@CollectResultsForMebit1For standard SELECT queries, this will attempt to put each database's results into a #temp table
@ErrorOnSkippedSitesbit0Set this to 1 if you want execution to halt in the event any site is missing due to transition change

Added some detail to the TIMESTAMPS section.
Source Link
Aaron Bertrand Staff
  • 42.8k
  • 11
  • 111
  • 203

All timestamps are UTC, default format: yyyy-MM-dd hh:mm:ss.fff (stored with millisecondsthree digits of millisecond precision as implemented by SQL Server, making the "end" of a day 23:59:59.997).

SELECT GetDate() At Time Zone 'UTC' At Time Zone 'Pacific Standard Time'
SELECT GetDate() At Time Zone 'UTC' At Time Zone 'Pacific Standard Time';

ToThe time zones do not have great names, as they imply that you would have to use 'Pacific Daylight Time' and know something about DST. To list listavailable time zones: SELECT * FROM sys.time_zone_info

All timestamps are UTC, default format: yyyy-MM-dd hh:mm:ss (stored with milliseconds).

SELECT GetDate() At Time Zone 'UTC' At Time Zone 'Pacific Standard Time'

To list time zones: SELECT * FROM sys.time_zone_info

All timestamps are UTC, default format: yyyy-MM-dd hh:mm:ss.fff (stored with three digits of millisecond precision as implemented by SQL Server, making the "end" of a day 23:59:59.997).

SELECT GetDate() At Time Zone 'UTC' At Time Zone 'Pacific Standard Time';

The time zones do not have great names, as they imply that you would have to use 'Pacific Daylight Time' and know something about DST. To list available time zones: SELECT * FROM sys.time_zone_info

added 2 characters in body
Source Link
Shadow Wizard
  • 172.9k
  • 32
  • 427
  • 844
Loading
https://meta.stackoverflow.com/questions/421038/the-ask-wizard-2022-has-graduated#comment931561_421041
Source Link
starball
  • 26.8k
  • 8
  • 52
  • 129
Loading
Add descriptions to a few fields on the Posts table
Source Link
zcoop98
  • 9.9k
  • 3
  • 26
  • 58
Loading
Improve description of PostTypeId 7
Source Link
zcoop98
  • 9.9k
  • 3
  • 26
  • 58
Loading
added nullable info to tagsynonyms after https://meta.stackexchange.com/a/388415
Source Link
rene
  • 91.1k
  • 17
  • 241
  • 511
Loading
Updated as it is now a circular reference (see https://meta.stackexchange.com/a/383323)
Source Link
Aaron Bertrand Staff
  • 42.8k
  • 11
  • 111
  • 203
Loading
votetypeid = 5 no longer present due to Saves
Source Link
rene
  • 91.1k
  • 17
  • 241
  • 511
Loading
added consensus explanation
Source Link
rene
  • 91.1k
  • 17
  • 241
  • 511
Loading
added functional meaning for closed markdown fields
Source Link
rene
  • 91.1k
  • 17
  • 241
  • 511
Loading
Updated name of ReviewTaskResultTypeIds 1 & 11, confirmed by review submission network request https://i.sstatic.net/ktiF4.png
Source Link
zcoop98
  • 9.9k
  • 3
  • 26
  • 58
Loading
ReviewTaskTypeId 12 for First Questions and 13 for First Answer
Source Link
Martin
  • 15.2k
  • 3
  • 30
  • 106
Loading
Fix indentation of "Comment" list in PostHistory
Source Link
zcoop98
  • 9.9k
  • 3
  • 26
  • 58
Loading
Rollback unintended changes caused by new editor
Source Link
zcoop98
  • 9.9k
  • 3
  • 26
  • 58
Loading
Added note about deleted posts under PostHistory heading
Source Link
zcoop98
  • 9.9k
  • 3
  • 26
  • 58
Loading
Mark that "ContentLicense" column is also included in PostsWithDeleted table
Source Link
zcoop98
  • 9.9k
  • 3
  • 26
  • 58
Loading
added 37 characters in body
Source Link
Glorfindel Mod
  • 252.6k
  • 61
  • 626
  • 1.3k
Loading
added extra meaning for events 52 and 53
Source Link
rene
  • 91.1k
  • 17
  • 241
  • 511
Loading
added 71 characters in body
Source Link
Cody Gray - on strike
  • 64.1k
  • 23
  • 195
  • 310
Loading
ContentLicense added
Source Link
rene
  • 91.1k
  • 17
  • 241
  • 511
Loading
added 64 characters in body
Source Link
Glorfindel Mod
  • 252.6k
  • 61
  • 626
  • 1.3k
Loading
added 6 characters in body
Source Link
Glorfindel Mod
  • 252.6k
  • 61
  • 626
  • 1.3k
Loading
updated CloseAsOffTopicReasonTypes based on https://meta.stackexchange.com/a/347162/307535
Source Link
Jeff Schaller
  • 2.1k
  • 1
  • 15
  • 26
Loading
1
2 3 4 5