how can I create a Column with the default value being an empty string?
如何创建一个默认值为空字符串的列?
thanks guys!
谢谢你们了!
3 个解决方案
#1
10
You can read up on the subject here
你可以在这里读一下这个题目
CREATE TABLE dbo.Test (ID INTEGER, EmptyString VARCHAR(32) DEFAULT '')
INSERT INTO dbo.Test (ID) VALUES (1)
INSERT INTO dbo.Test (ID) VALUES (2)
SELECT * FROM dbo.Test
DROP TABLE dbo.Test
#2
5
Something like:
喜欢的东西:
CREATE TABLE foobar (string_column VARCHAR(100) NOT NULL DEFAULT '')
创建表foobar (string_column VARCHAR(100) NOT NULL DEFAULT)
#3
5
In SQL server you can set "Column properties > Default value or binding" section to ('')
. NOTE: It includes single quotation and parenthesis
在SQL server中,可以将“列属性>默认值或绑定”部分设置为()。注意:它包括单引号和括号
#1
10
You can read up on the subject here
你可以在这里读一下这个题目
CREATE TABLE dbo.Test (ID INTEGER, EmptyString VARCHAR(32) DEFAULT '')
INSERT INTO dbo.Test (ID) VALUES (1)
INSERT INTO dbo.Test (ID) VALUES (2)
SELECT * FROM dbo.Test
DROP TABLE dbo.Test
#2
5
Something like:
喜欢的东西:
CREATE TABLE foobar (string_column VARCHAR(100) NOT NULL DEFAULT '')
创建表foobar (string_column VARCHAR(100) NOT NULL DEFAULT)
#3
5
In SQL server you can set "Column properties > Default value or binding" section to ('')
. NOTE: It includes single quotation and parenthesis
在SQL server中,可以将“列属性>默认值或绑定”部分设置为()。注意:它包括单引号和括号