SQL Server中改变表列字段长度的SQL是什么

编程入门 行业动态 更新时间:2024-10-28 20:17:24
本文介绍了SQL Server中改变表列字段长度的SQL是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

使字段从 nvarchar(50) 变为 nvarchar(250) 的 SQL 是什么?

What is the SQL to make a field go from nvarchar(50) to nvarchar(250)?

当我尝试通过 SQL Server Management Studio 更改它时,它不允许我这样做,所以我想我会直接尝试 SQL 而不是使用 GUI.

When I try to change it through the SQL Server Management Studio, it doesn't allow me to do it, so I figured I would try SQL directly instead of using the GUI.

推荐答案

Alter table tblname ALTER Column colname nvarchar(250) [NOT] NULL

如果未指定 NULL/NOT NULL,则无论原始规范是什么,该列都将变为 Nullable.

If NULL / NOT NULL is not specified the column will become Nullable irrespective of what ever the original specification was.

更多推荐

SQL Server中改变表列字段长度的SQL是什么

本文发布于:2023-10-18 18:27:47,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1505023.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字段   长度   SQL   Server

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!