<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Databases on bradleycarey.com</title>
    <link>https://bradleycarey.com/categories/databases/</link>
    <description>Recent content in Databases on bradleycarey.com</description>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Tue, 05 Dec 2023 14:05:41 -0500</lastBuildDate>
    <atom:link href="https://bradleycarey.com/categories/databases/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>SQL Server (T-SQL) Data Types to system_type_id list (2022 update)</title>
      <link>https://bradleycarey.com/posts/2012-11-12-sql-server-transact-sql-data-types-to-system_type_id-list/</link>
      <pubDate>Tue, 05 Apr 2022 10:33:59 -0400</pubDate>
      <guid>https://bradleycarey.com/posts/2012-11-12-sql-server-transact-sql-data-types-to-system_type_id-list/</guid>
      <description>&lt;p&gt;I received metadata for a SQL Server database which contained the system_type_id but not what I needed: the data types of each column. Google did not seem to have a list of these so I ran the queries and posted them here as reference. I hope you find it useful.&lt;/p&gt;&#xA;&lt;table&gt;&#xA;  &lt;thead&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;th&gt;system_type_id&lt;/th&gt;&#xA;          &lt;th&gt;datatype&lt;/th&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/thead&gt;&#xA;  &lt;tbody&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;34&lt;/td&gt;&#xA;          &lt;td&gt;image&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;35&lt;/td&gt;&#xA;          &lt;td&gt;text&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;36&lt;/td&gt;&#xA;          &lt;td&gt;uniqueidentifier&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;40&lt;/td&gt;&#xA;          &lt;td&gt;date&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;41&lt;/td&gt;&#xA;          &lt;td&gt;time&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;42&lt;/td&gt;&#xA;          &lt;td&gt;datetime2&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;43&lt;/td&gt;&#xA;          &lt;td&gt;datetimeoffset&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;48&lt;/td&gt;&#xA;          &lt;td&gt;tinyint&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;52&lt;/td&gt;&#xA;          &lt;td&gt;smallint&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;56&lt;/td&gt;&#xA;          &lt;td&gt;int&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;58&lt;/td&gt;&#xA;          &lt;td&gt;smalldatetime&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;59&lt;/td&gt;&#xA;          &lt;td&gt;real&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;60&lt;/td&gt;&#xA;          &lt;td&gt;money&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;61&lt;/td&gt;&#xA;          &lt;td&gt;datetime&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;62&lt;/td&gt;&#xA;          &lt;td&gt;float&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;98&lt;/td&gt;&#xA;          &lt;td&gt;sql_variant&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;99&lt;/td&gt;&#xA;          &lt;td&gt;ntext&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;104&lt;/td&gt;&#xA;          &lt;td&gt;bit&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;106&lt;/td&gt;&#xA;          &lt;td&gt;decimal&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;108&lt;/td&gt;&#xA;          &lt;td&gt;numeric&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;122&lt;/td&gt;&#xA;          &lt;td&gt;smallmoney&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;127&lt;/td&gt;&#xA;          &lt;td&gt;bigint&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;165&lt;/td&gt;&#xA;          &lt;td&gt;varbinary&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;167&lt;/td&gt;&#xA;          &lt;td&gt;varchar&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;173&lt;/td&gt;&#xA;          &lt;td&gt;binary&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;175&lt;/td&gt;&#xA;          &lt;td&gt;char&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;189&lt;/td&gt;&#xA;          &lt;td&gt;timestamp&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;231&lt;/td&gt;&#xA;          &lt;td&gt;nvarchar&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;239&lt;/td&gt;&#xA;          &lt;td&gt;nchar&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;241&lt;/td&gt;&#xA;          &lt;td&gt;xml&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Here is the SQL query I used to get the above data:&lt;/p&gt;</description>
    </item>
    <item>
      <title>SSMS – Selecting rows as json truncates long json strings</title>
      <link>https://bradleycarey.com/posts/selecting-rows-as-json-truncates-long-json-strings/</link>
      <pubDate>Sun, 18 Nov 2018 00:40:04 -0500</pubDate>
      <guid>https://bradleycarey.com/posts/selecting-rows-as-json-truncates-long-json-strings/</guid>
      <description>&lt;p&gt;In the newer versions of Microsoft SQL Server, it is now super easy to &lt;a href=&#34;https://docs.microsoft.com/en-us/sql/relational-databases/json/format-query-results-as-json-with-for-json-sql-server&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;return selected rows as json data&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Unfortunately, SSMS seems to truncate json strings that are longer than 2033 chars no matter what you do. This seems to happen no matter if you show the results in the grid, text, or a file.&lt;/p&gt;&#xA;&lt;p&gt;Here is a workaround using a variable and &lt;code&gt;PRINT&lt;/code&gt; if you want to just get the json string on your clipboard:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Using SQL Server Reporting Services (SSRS) in an ASP.NET MVC project</title>
      <link>https://bradleycarey.com/posts/2015-06-08-using-sql-server-reporting-services-ssrs-in-an-asp-net-mvc-project/</link>
      <pubDate>Mon, 08 Jun 2015 14:21:49 -0400</pubDate>
      <guid>https://bradleycarey.com/posts/2015-06-08-using-sql-server-reporting-services-ssrs-in-an-asp-net-mvc-project/</guid>
      <description>&lt;p&gt;There are a handful of examples out on the internet on how to use SSRS from an ASP.NET website but all of the ones I came across seemed like hacks. They range from throwing an ASPX page with a ReportViewer control to complex JavaScript hacks. The following method is the one I have used for many years that adheres to the true MVC manner. This method connects to SSRS through the web service using Microsoft.Reporting.WebForms assembly.&lt;/p&gt;</description>
    </item>
    <item>
      <title>SAS Data File to PostgreSQL friendly CSV using Perl</title>
      <link>https://bradleycarey.com/posts/2012-12-24-sas-data-file-to-postgresql-friendly-csv-using-perl/</link>
      <pubDate>Mon, 24 Dec 2012 00:06:39 -0400</pubDate>
      <guid>https://bradleycarey.com/posts/2012-12-24-sas-data-file-to-postgresql-friendly-csv-using-perl/</guid>
      <description>&lt;p&gt;In my database course at Marshall University, I helped my professor with a side project involving Cancer research data that has been collected since 1973 by the National Cancer Institute. My first job was to take the &lt;a href=&#34;http://seer.cancer.gov/about/&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;SEER&lt;/a&gt; data and load it into a postgreSQL database.&lt;/p&gt;&#xA;&lt;p&gt;The job was simple enough. The only problem? The data files were in &lt;a href=&#34;http://en.wikipedia.org/wiki/SAS_%28software%29&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;SAS format&lt;/a&gt;. Basically the format was CRLF delimited entries composed of fixed-length fields. &lt;a href=&#34;http://seer.cancer.gov/manuals/read.seer.research.nov2011.sas&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Here&lt;/a&gt; is a list of the fields and lengths that I used for the script.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
