开发者

How can I set the maximum number of characters per column using sqlcmd?

While using SQL Server Managemen开发者_StackOverflow社区t Studio, I generally do:

Query->Query Options->Advanced->SET NOCOUNT
Query->Query Options->Text->Enter 8000 in the lower right box

Can someone please tell me if there is anyway I could do this using sqlcmd?


You have these switches for sqlcmd that affect width etc

  • -w
  • -Y
  • -y


I don't know if this is exactly what you are trying to do, but to set data type in the column for example to varchar with maximum length 30:

sqlcmd -E -d dbname -Q "ALTER TABLE table_name
                          ALTER COLUMN column_name varchar(30) NOT NULL"

For database named 'dbname' on your local machine.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜