Answer the question
In order to leave comments, you need to log in
How to write an array of integers to a cell in MSSQL Server 2012?
It is necessary for each line to store an array of integers of 10 elements.
At first I did it as a translation into a line with separators, then as 10 fields for each element.
Both options are inconvenient.
Ideally, I want to write down a field as a BLOB in binary (varbinary), but I don't know how.
Environment: Delphi XE2;
DBMS: MS SQL Server 2012
Answer the question
In order to leave comments, you need to log in
You are about to make an architectural mistake. The best is to use 10 columns.
The table is already an array. No need to be smart and write another one to the array.
It is best to write in an XML type field, here is the convenience of recording and sampling.
Here is an example in t sql:
DECLARE @i int = 0
DECLARE @table TABLE(num int)
WHILE @i < 10
BEGIN
INSERT INTO @table (num)
VALUES (@i);
SET @i = @i + 1
END
SELECT * FROM @table FOR XML RAW('numbers') -- тут нужная вам xml строчка
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question