The advent of AI has ushered in ground breaking changes in most areas of technology. AI is synonymous with a humongous amount of data, data of all types including text, image, audio and video. The databases of the future needs to cater to this changing vista of data and yet compatible with existing technologies.
Microsoft SQL Server has always catered to the technological changes and along its developmental path has introduced many data types to handle diverse data varieties and in recent years has introduced data types such as, "Json', "Stock" and "Geographical" data types. These address the stock market and the geographical data that accompanies all global operations.
In addition to data types, it has also changed itself to accommodate not only relational data but also non-relational NoSQL type of data using integration with polyphase technology.
Vector Data Type
SQL Server 2025 has introduced a new **vector data type** designed to store vector data optimized for operations like similarity search and machine learning applications. This is quite a leap for a relational database management system (RDBMS), as it traditionally handles structured data but can handle NoSQL Data.
How is Vector datatype stored in the SQL Server 2025?
A vector in SQL Server is typically stored as a JSON array of floating-point values. Here's an example of how you might define and use a vector in SQL Server:
-- Create a table with a vector column
CREATE TABLE dbo.vectors (
id INT PRIMARY KEY,
v VECTOR(3) NOT NULL
);
-- Insert data into the table
INSERT INTO dbo.vectors (id, v) VALUES
(1, '[0.11, 2, -35]'),
(2, '[-100.2, 0.0123, 9.876]'
-- Select data from the table
SELECT * FROM dbo.vectors;
This table with two columns has a column of vector data type not null. The vectors are [0.11, 2, -35] and [-100.2, 0.0123, 9.876]
The columns store three dimensional vectors with each dimension stored as a single-precision floating point (float type).
Vector Data Type is not available in 2022
The vector data type is not available in SQL Server 2022. You may have to store vector data type in a JSON column or something customized.
Image Processing and AI
In recent times image processing has been intensely studied. One may ask how to store the dimensional representation of an image. Well, images can have a very high dimensional representation.
• Grayscale Image: A 100x100 pixel grayscale image can be represented as a 10,000-dimensional vector (100x100 = 10,000).
• Color Image: A 100x100 pixel color image with RGB channels can be represented as a 30,000-dimensional vector (100x100x3 = 30,000).
In SQL Server 2025, the maximum number of dimensions that can be stored using the vector data type is 1998. Each element of the vector is stored as a single-precision (4-byte) floating-point value.
Can image dimensions be stored in SQL Server 2025?
The short answer for storing image dimensions in SQL Server is that it is not possible to store image dimensions without reducing the number of dimensions. There are techniques to reduce the dimensions with various pay offs in quality. We shall discuss them in a later post using a programming language such as python with the use of certain libraries.
Going forward in populating vector data type into the server the SQL Server Integration services can be used to preprocess the image data and then populate the database. This will also be for a future post.
If you are looking for working with databases, stay in and learn from over 15 years of blogging on databases here. http://hodentekMSSS.blogspot.com
You may also have a look at my database related books: