我有一个包含很多列和行的表 (myData),并有另一个表 (myFileNo) 单值,这意味着单行、单列、单单元格 (FileNo),
I have a table (myData) with lots of columns and rows, and have another table (myFileNo) single value which means single row, single column, single cell (FileNo),
我写了一个 sql 查询,它通过检查 myFileNo 更新 myData,并在进程结束后更改 FileNo 的值.
I wrote an sql query which updates myData by checking myFileNo, and after process ends it changes the value of FileNo.
将单值数据保存在表中对我来说没有多大意义,这是正确的做法吗?
It does not make much sense to me to keep the single value data in a table, is this the proper way to do it ?
FileNo 的目的
它充当标识号,但不像主键那样创建.一个例子(之前和之后):
It acts as an identification number, but not created like a primary key. An example (before, and after):
之前
myData, FileNo
A, NULL
A, NULL
B, NULL
C, NULL
A, NULL
D, NULL
D, NULL
文件编号:15
之后
myData, FileNo
A, 16
A, 16
B, 17
C, 18
A, 16
D, 19
D, 19
FileNo: 19
如果 fileNo 被多个表和进程引用,然后将其存储在一个表中就可以了,您可以调查扩展属性,但我会保留放在桌子上.
In the case that the fileNo is being referenced by multiple tables and processes then storing it in a table is fine, you could investigate extended properties, but I would keep it in a table.
如果你只需要这个表并且你只需要能够识别下一次加载的最大值+1,我建议你在插入之前检查Max(FileNo),前提是这不会导致性能问题,基于表的大小.
If you only need it for this table and you only need to be able to identify the maximum value + 1 for the next load, I suggest you just check Max(FileNo) before inserting, providing this does not cause performance issues, based on the size of the table.
这篇关于在sql server中保留单个数据的正确方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
修改现有小数位信息Modify Existing decimal places info(修改现有小数位信息)
多次指定相关名称“CONVERT"The correlation name #39;CONVERT#39; is specified multiple times(多次指定相关名称“CONVERT)
T-SQL 左连接不返回空列T-SQL left join not returning null columns(T-SQL 左连接不返回空列)
从逗号或管道运算符字符串中删除重复项remove duplicates from comma or pipeline operator string(从逗号或管道运算符字符串中删除重复项)
将迭代查询更改为基于关系集的查询Change an iterative query to a relational set-based query(将迭代查询更改为基于关系集的查询)
将零连接到 sql server 选择值仍然显示 4 位而不是concatenate a zero onto sql server select value shows 4 digits still and not 5(将零连接到 sql server 选择值仍然显示 4 位而不是 5)