开发者

Can we delete single column data which is using ID of its row with the help of my procedure?

I have one special case in my sql server 2008. I want to delete single column data which is using ID of its row with the help of my procedure. How can i achive this 开发者_如何转开发can any one please help me?


You say that you want to do

If(Id=1001) 
delete Mycolumn 
from Mytable 
where Id=@Id;

You can't "delete" a column in a specific row as all rows must have exactly the same columns.

I assume you need something like this.

UPDATE Mytable 
SET Mycolumn = NULL
WHERE Id=@Id;


You want to remove column or set data to null ?

If you want to set data to null then try this :

UPDATE tablename
SET colname = NULL 
WHERE Id=@Id; 

if you want to remove column then try ALTER TABLE DROP COLUMN command

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜