创建带有和不带有大小说明的表 [英] Create Table with and without specification of size
本文介绍了创建带有和不带有大小说明的表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下是我的sql语句,我的问题
在这里,当未指定任何大小时,其默认值会变为(1)
对于数值数据类型(如int),其大小为4
用于字符串数据类型,是否必须指定大小
我需要存储将为10个字符的char数据,char的默认大小仅为1
创建表[dbo] .finaltb(col1 char)
below is my sql statement,my question
here when am not specifying any size its default getting (1)
and for numeric datatypes like int its having size 4
is for string datatypes is it mandatory specify size
i need to store char data which will be 10 characters is char default size is only 1
CREATE TABLE [dbo].finaltb(col1 char)
推荐答案
Try
Try
CREATE TABLE [dbo].finaltb (col1 char(10))
创建表[dbo] .finaltb (col1 char(10))
否则
创建表[dbo] .finaltb(col1 varchar(10))
CREATE TABLE [dbo].finaltb (col1 char(10))
Or else
CREATE TABLE [dbo].finaltb (col1 varchar(10))
这篇关于创建带有和不带有大小说明的表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文