--創建表 create table tblA(Title varchar(20),counts tinyint) --插入數據 insert tblA values(null,null) --查詢 select * from tblA --刪除表 drop tblA
--創建表 create table tblA(Title varchar(20),counts tinyint) --插入數據 insert tblA values(null,null) --查詢 select * from tblA --刪除表 drop table tblA
if exists (select * from dbo.sysobjects where id=object_id(N'dbo.test') and objectproperty(id,N'isUserTable')=1) drop table test gocreate table test ( myid int, myname varchar(20), age tinyint )insert into test values('04020053',null,null)select * from test 结果是:4020053 NULL NULL可以的
對于那兩種類型的字段就是如果你想插入NULL空值的話 在創建表的時候一定不要設置 NOT NULL這樣插入空值會被拒絕的
create table tblA(Title varchar(20),counts tinyint)
--插入數據
insert tblA values(null,null)
--查詢
select * from tblA
--刪除表
drop tblA
create table tblA(Title varchar(20),counts tinyint)
--插入數據
insert tblA values(null,null)
--查詢
select * from tblA
--刪除表
drop table tblA
if exists (select * from dbo.sysobjects where id=object_id(N'dbo.test') and objectproperty(id,N'isUserTable')=1)
drop table test
gocreate table test
(
myid int,
myname varchar(20),
age tinyint
)insert into test values('04020053',null,null)select * from test
结果是:4020053 NULL NULL可以的
在創建表的時候一定不要設置 NOT NULL這樣插入空值會被拒絕的