manipulate array of data in SQL
来源:互联网 发布:淘宝客如何转成淘口令 编辑:程序博客网 时间:2024/04/30 05:42
As we know, SQL server lacks of concept of array.
a workaround is to store the data in a table variable and then iterate it.
one way to do iterate is using cursor, but it's slow
another way is add a id column in the table variable, and then access the record in table variable with index.
DECLARE @UserName VARCHAR(30), @DisplayName VARCHAR(30)
DECLARE @Users TABLE(Id int identity(1,1), UserName VARCHAR(30), DisplayName VARCHAR(30))
INSERT INTO @Users
VALUES
('lxing', 'Lili')
,('ashan', 'Allen')
DECLARE @RowsToProcess int = @@ROWCOUNT
DECLARE @Row INT=1
WHILE(@Row <= @RowsToProcess)
BEGIN
SELECT @UserName = UserName, @DisplayName = DisplayName FROM @Users where Id = @Row
declare @uid int
--insert user
SET @Row = @Row + 1
END
- manipulate array of data in SQL
- Using LINQ to manipulate data in DataSet/DataTable
- Manipulate bits in C
- Array of Data Structure
- using an enumerable built-in Ruby to access and manipulate nested data
- [LinkedIn] Smallest/greatest/largest k element in stream of data (integer array) priority Q / heap
- Array in PL/SQL
- Usage of Array in Perl
- This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its
- Extracting Data from array of hashes Ruby
- saving data - Saving Data in SQL Databases
- Saving Data in SQL Databases
- Saving Data in SQL Databases
- Sorting an array of hash in Ruby
- Thinking of Search in Rotated Sorted Array
- 错误码: 1418 This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and
- This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its de 错误解决办法
- This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its de 错误解决办法
- RESTful api接口规范
- C#中HttpWebRequest的GetRequestStream执行的效率太低,甚至偶尔死掉
- Android手机利用加速度统计跌落次数
- 移动端自由移动元素位置
- 密码等级:至少包含字母、大小写数字、字符中的两种 JS实现方案
- manipulate array of data in SQL
- angularJS2.0入门 命令行/npm下载安装
- git push 出现 you are not allowed to upload merges 错误提示
- 设计模式之----策略模式
- 欢迎使用CSDN-markdown编辑器
- Java 中的自动类型转换
- JNI数据类型和签名(Signatures)
- 在Myeclipse中导入工程后会出现Can not find the tag library descriptor for "http://java.sun.com/jsp/jstl/core
- HDU The 3n + 1 problem