SQL 无法在数据类型 int 上指定列宽

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23224296/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 01:41:06  来源:igfitidea点击:

Cannot specify a column width on data type int

sqlsql-serversyntax-error

提问by Toussaint

I'm new here. I'm attempting to create a table in ms sqldatabase using mylittleadmin. I've read and reread the code and can't seem to figure out why I am getting the following error:

我是新来的。我正在尝试使用mylittleadminms sql数据库中创建一个表。我已经阅读并重新阅读了代码,但似乎无法弄清楚为什么会出现以下错误:

"Msg 2716, Level 16, State 1, Line number 1 Column, parameter, or variable #8: Cannot specify a column width on data type int."

消息 2716,级别 16,状态 1,行号 1 列、参数或变量 #8:无法在数据类型 int 上指定列宽。

The code is as follows...

代码如下...

CREATE TABLE surrogate(
Last_Name1 VarChar(255),
First_Name1 VarChar(255),
ID int,
Street_Address int,
City VarChar(255),
State_or_Province VarChar(255),
Country VarChar(255),
Zip_Code int(255),
Home_Phone int,
Mobile_Phone int,
Work_Phone int,
Email VarChar(255),
Last_Name2 VarChar(255),
First_Name2 VarChar(255),
ID int,
Street_Address2 int,
City2 VarChar(255),
State_or_Province2 VarChar(255),
Country2 VarChar(255),
Zip_Code2 int,
Home_Phone2 int,
Mobile_Phone2 int,
Work_Phone2 int,
Email2 VarChar(255),
Last_Name3 VarChar(255), 
First_Name3 VarChar(255),
ID int,
Street_Address3 int,
City3 VarChar(255),
State_or_Province3 VarChar(255),
Country3 VarChar (255),
Zip_Code3 int,
Home_Phone3 int,
Mobile_Phone3 int,
Work_Phone3 int,
Email3 VarChar(255))

回答by Satwik Nadkarny

Its just a typo mistake. Guess you haven't seen it yet. This is the problem:

它只是一个错字错误。估计你还没看过。这就是问题:

Zip_Code int(255),

Change it to

将其更改为

Zip_Code int,

Hope this helps!!!

希望这可以帮助!!!