SQL Server中改变表列字段长度的SQL是什么 [英] What is the SQL to change the field length of a table column in SQL Server

查看:35
本文介绍了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是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆