惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

量子位
云风的 BLOG
云风的 BLOG
小众软件
小众软件
IT之家
IT之家
T
Tailwind CSS Blog
WordPress大学
WordPress大学
S
SegmentFault 最新的问题
美团技术团队
博客园 - 叶小钗
V
V2EX
博客园 - Franky
大猫的无限游戏
大猫的无限游戏
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
阮一峰的网络日志
阮一峰的网络日志
博客园 - 【当耐特】
罗磊的独立博客
博客园_首页
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
爱范儿
爱范儿
宝玉的分享
宝玉的分享
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Jina AI
Jina AI
月光博客
月光博客
有赞技术团队
有赞技术团队

博客园 - 焰凌

When we need to inherit from WSS WebPart class? The issue of upload big file on SharePoint with IIS7 Why no effects when change the "Site Master Page Settings" from "Site Actions - Site Settings - Look and Feel - Master Page"? 怎样在MOSS2007和WSS3.0中修改服务帐户和密码 HttpApplication机制 "NOT IN", "JOIN...IS NULL", "NOT EXISTS" 之间的效率对比 为SharePoint新项目做准备 MOSS 2007 SSP (1) How to create and delete a SharePoint site by web application Search user of specific domain name Received DGT's document 水晶报表PUSH模式多个表数据的显示 上海电信之具有地域歧视的霸王条款 来上海一年多了,第一次感冒! differentia of [string str=null;] and [string str="";] 搬家了,没宽带了 工作以后 找不到状态了! 页面缓存的困扰
Poor code: Dynamic changing of table schema
焰凌 · 2008-08-12 · via 博客园 - 焰凌

When you write SQL Scripts or Stored Procedures. Please keep in mind that don't change the schema of table with update data for the table together.

Problem repro steps:

1: prepare following scripts:

Code

2: Excute line 1. Then the DB has a new table named TestTable with two columns FieldA and FieldB.

3: Excute line 2 and line 3 together. The error occured. Invalid column name 'FieldC'.

Explain problem:

Theoretically line 2 and line 3 are correct. add a new column and then update the value of this new column. When you execute these two lines separately, the result is success. But it will cause the error if you execute them together.

Solution:

1: Don't change the schema with data update. Separate them to two different part. Such as two different stored procedure.

2: Make your schema stable. Change the line 1 to SELECT FieldA=0, FieldB=1, Fieldc=NULL INTO TestTable