Access 数据类型与 MS SQL 数据类型相对应名称
[size=3][color=#000000][font=宋体]文本[/font][font=Times New Roman] nvarchar(n)[/font][/color][/size]
[size=3][color=#000000][font=宋体]备注[/font][font=Times New Roman] ntext
[/font][/color][/size]
[size=3][color=#000000][font=宋体]数字[/font][font=Times New Roman]([/font][font=宋体]长整型[/font][font=Times New Roman]) int
[/font][/color][/size]
[size=3][color=#000000][font=宋体]数字[/font][font=Times New Roman]([/font][font=宋体]整型[/font][font=Times New Roman]) smallint
[/font][/color][/size]
[size=3][color=#000000][font=宋体]数字[/font][font=Times New Roman]([/font][font=宋体]单精度[/font][font=Times New Roman]) real
[/font][/color][/size]
[size=3][color=#000000][font=宋体]数字[/font][font=Times New Roman]([/font][font=宋体]双精度[/font][font=Times New Roman]) float
[/font][/color][/size]
[size=3][color=#000000][font=宋体]数字[/font][font=Times New Roman]([/font][font=宋体]字节[/font][font=Times New Roman]) tinyint
[/font][/color][/size]
[size=3][color=#000000][font=宋体]货币[/font][font=Times New Roman] m
[/font][/color][/size]
[size=3][color=#000000][font=Times New Roman](1)char[/font][font=宋体]、[/font][font=Times New Roman]varchar[/font][font=宋体]、[/font][font=Times New Roman]text[/font][font=宋体]和[/font][font=Times New Roman]nchar[/font][font=宋体]、[/font][font=Times New Roman]nvarchar[/font][font=宋体]、[/font][font=Times New Roman]ntext
[/font][/color][/size]
[size=3][color=#000000][font=Times New Roman]char[/font][font=宋体]和[/font][font=Times New Roman]varchar[/font][font=宋体]的长度都在[/font][font=Times New Roman]1[/font][font=宋体]到[/font][font=Times New Roman]8000[/font][font=宋体]之间,它们的区别在于[/font][font=Times New Roman]char[/font][font=宋体]是定长字符数据,而[/font][font=Times New Roman]varchar[/font][font=宋体]是变长字符数据。所谓定长就是长度固定的,当输入的数据长度没有达到指定的长度时将自动以英文空格在其后面填充,使长度达到相应的长度;而变长字符数据则不会以空格填充。[/font][font=Times New Roman]text[/font][font=宋体]存储可变长度的非[/font][font=Times New Roman]Unicode[/font][font=宋体]数据,最大长度为[/font][font=Times New Roman]2^31-1(2,147,483,647)[/font][font=宋体]个字符。[/font][font=Times New Roman]
[/font][/color][/size]
[size=3][color=#000000][font=宋体]后面三种数据类型和前面的相比,从名称上看只是多了个字母[/font][font=Times New Roman]"n"[/font][font=宋体],它表示存储的是[/font][font=Times New Roman]Unicode[/font][font=宋体]数据类型的字符。写过程序的朋友对[/font][font=Times New Roman]Unicode[/font][font=宋体]应该很了解。字符中,英文字符只需要一个字节存储就足够了,但汉字众多,需要两个字节存储,英文与汉字同时存在时容易造成混乱,[/font][font=Times New Roman]Unicode[/font][font=宋体]字符集就是为了解决字符集这种不兼容的问题而产生的,它所有的字符都用两个字节表示,即英文字符也是用两个字节表示。[/font][font=Times New Roman]nchar[/font][font=宋体]、[/font][font=Times New Roman]nvarchar[/font][font=宋体]的长度是在[/font][font=Times New Roman]1[/font][font=宋体]到[/font][font=Times New Roman]4000[/font][font=宋体]之间。和[/font][font=Times New Roman]char[/font][font=宋体]、[/font][font=Times New Roman]varchar[/font][font=宋体]比较:[/font][font=Times New Roman]nchar[/font][font=宋体]、[/font][font=Times New Roman]nvarchar[/font][font=宋体]则最多存储[/font][font=Times New Roman]4000[/font][font=宋体]个字符,不论是英文还是汉字;而[/font][font=Times New Roman]char[/font][font=宋体]、[/font][font=Times New Roman]varchar[/font][font=宋体]最多能存储[/font][font=Times New Roman]8000[/font][font=宋体]个英文,[/font][font=Times New Roman]4000[/font][font=宋体]个汉字。可以看出使用[/font][font=Times New Roman]nchar[/font][font=宋体]、[/font][font=Times New Roman]nvarchar[/font][font=宋体]数据类型时不用担心输入的字符是英文还是汉字,较为方便,但在存储英文时数量上有些损失。[/font][font=Times New Roman]
[/font][/color][/size]
[size=3][color=#000000][font=Times New Roman](2)datetime[/font][font=宋体]和[/font][font=Times New Roman]smalldatetime
[/font][/color][/size]
[size=3][color=#000000][font=Times New Roman]datetime[/font][font=宋体]:从[/font][font=Times New Roman]1753[/font][font=宋体]年[/font][font=Times New Roman]1[/font][font=宋体]月[/font][font=Times New Roman]1[/font][font=宋体]日[/font][font=宋体]到[/font][font=Times New Roman]9999[/font][font=宋体]年[/font][font=Times New Roman]12[/font][font=宋体]月[/font][font=Times New Roman]31[/font][font=宋体]日[/font][font=宋体]的日期和时间数据,精确到百分之三秒。[/font][font=Times New Roman]
[/font][/color][/size]
[size=3][color=#000000][font=Times New Roman]smalldatetime[/font][font=宋体]:从[/font][font=Times New Roman]1900[/font][font=宋体]年[/font][font=Times New Roman]1[/font][font=宋体]月[/font][font=Times New Roman]1[/font][font=宋体]日[/font][font=宋体]到[/font][font=Times New Roman]2079[/font][font=宋体]年[/font][font=Times New Roman]6[/font][font=宋体]月[/font][font=Times New Roman]6[/font][font=宋体]日[/font][font=宋体]的日期和时间数据,精确到分钟。[/font][font=Times New Roman]
[/font][/color][/size]
[size=3][color=#000000][font=Times New Roman](3)bitint[/font][font=宋体]、[/font][font=Times New Roman]int[/font][font=宋体]、[/font][font=Times New Roman]smallint[/font][font=宋体]、[/font][font=Times New Roman]tinyint[/font][font=宋体]和[/font][font=Times New Roman]bit
[/font][/color][/size]
[size=3][color=#000000][font=Times New Roman]bigint[/font][font=宋体]:从[/font][font=Times New Roman]-2^63(-9223372036854775808)[/font][font=宋体]到[/font][font=Times New Roman]2^63-1(9223372036854775807)[/font][font=宋体]的整型数据。[/font][font=Times New Roman]
[/font][/color][/size]
[size=3][color=#000000][font=Times New Roman]int[/font][font=宋体]:从[/font][font=Times New Roman]-2^31(-2,147,483,648)[/font][font=宋体]到[/font][font=Times New Roman]2^31-1(2,147,483,647)[/font][font=宋体]的整型数据。[/font][font=Times New Roman]
[/font][/color][/size]
[size=3][color=#000000][font=Times New Roman]smallint[/font][font=宋体]:从[/font][font=Times New Roman]-2^15(-32,768)[/font][font=宋体]到[/font][font=Times New Roman]2^15-1(32,767)[/font][font=宋体]的整数数据。[/font][font=Times New Roman]
[/font][/color][/size]
[size=3][color=#000000][font=Times New Roman]tinyint[/font][font=宋体]:从[/font][font=Times New Roman]0[/font][font=宋体]到[/font][font=Times New Roman]255[/font][font=宋体]的整数数据。[/font][font=Times New Roman]
[/font][/color][/size]
[size=3][color=#000000][font=Times New Roman]bit[/font][font=宋体]:[/font][font=Times New Roman]1[/font][font=宋体]或[/font][font=Times New Roman]0[/font][font=宋体]的整数数据。[/font][font=Times New Roman]
[/font][/color][/size]
[size=3][color=#000000][font=Times New Roman](4)decimal[/font][font=宋体]和[/font][font=Times New Roman]numeric[/font][font=宋体]这两种数据类型是等效的。都有两个参数:[/font][font=Times New Roman]p[/font][font=宋体](精度)和[/font][font=Times New Roman]s[/font][font=宋体](小数位数)。[/font][font=Times New Roman]p[/font][font=宋体]指定小数点左边和右边可以存储的十进制数字的最大个数,[/font][font=Times New Roman]p[/font][font=宋体]必须是从[/font][font=Times New Roman] 1[/font][font=宋体]到[/font][font=Times New Roman]38[/font][font=宋体]之间的值。[/font][font=Times New Roman]s[/font][font=宋体]指定小数点右边可以存储的十进制数字的最大个数,[/font][font=Times New Roman]s[/font][font=宋体]必须是从[/font][font=Times New Roman]0[/font][font=宋体]到[/font][font=Times New Roman]p[/font][font=宋体]之间的值,默认小数位数是[/font][font=Times New Roman]0[/font][font=宋体]。[/font][font=Times New Roman]
[/font][/color][/size]
[size=3][color=#000000][font=Times New Roman](5)float[/font][font=宋体]和[/font][font=Times New Roman]real
[/font][/color][/size]
[size=3][color=#000000][font=Times New Roman]float[/font][font=宋体]:从[/font][font=Times New Roman]-1.79^308[/font][font=宋体]到[/font][font=Times New Roman]1.79^308[/font][font=宋体]之间的浮点数字数据。[/font][font=Times New Roman]
[/font][/color][/size]
[size=3][color=#000000][font=Times New Roman]real[/font][font=宋体]:从[/font][font=Times New Roman]-3.40^38[/font][font=宋体]到[/font][font=Times New Roman]3.40^38[/font][font=宋体]之间的浮点数字数据。在[/font][font=Times New Roman]SQL Server[/font][font=宋体]中,[/font][font=Times New Roman]real[/font][font=宋体]的同义词为[/font][font=Times New Roman]float(24)[/font][font=宋体]。[/font][font=Times New Roman]
[/font][/color][/size]
[size=3][color=#000000][font=宋体]很多朋友想用[/font][font=Times New Roman]SQL2000[/font][font=宋体]数据库的编程方法,但是却又苦于自己是学[/font][font=Times New Roman]ACCESS[/font][font=宋体]的,对[/font][font=Times New Roman]SQL[/font][font=宋体]只是一点点的了解而已,这里我给大家提供以下参考[/font][font=Times New Roman]---[/font][font=宋体]将[/font][font=Times New Roman]ACCESS[/font][font=宋体]转化成[/font][font=Times New Roman]SQL2000[/font][font=宋体]的方法和注意事项[/font][font=Times New Roman]
[/font][/color][/size]
[size=3][color=#000000][font=Times New Roman] [/font][font=宋体]一,首先,我说的是在[/font][font=Times New Roman]ACCESS2000[/font][font=宋体],[/font][font=Times New Roman]SQL2000[/font][font=宋体]之间转换,其他的我也还没有尝试过,希望大家多多试验,肯定是有办法的;[/font][font=Times New Roman]
[/font][/color][/size]
[size=3][color=#000000][font=Times New Roman][/font][font=宋体]二,转换的方法[/font][font=Times New Roman]
1[/font][font=宋体],打开”控制面板“下”管理工具“中的”数据库源“;[/font][font=Times New Roman]
[/font][/color][/size]
[size=3][color=#000000][font=Times New Roman]
2[/font][font=宋体],按”添加“添加一个新的数据源,在选择栏里选”[/font][font=Times New Roman]Driver do microsoft Access
[/font][/color][/size]
[size=3][color=#000000][font=Times New Roman]
(*.mdb)[/font][font=宋体]”[/font][font=Times New Roman],[/font][font=宋体]完成后将出现一个框[/font][font=Times New Roman],
[/font][/color][/size]
[size=3][color=#000000][font=Times New Roman]
[/font][/color][/size]
[size=3][color=#000000][font=Times New Roman] [/font][font=宋体]在”数据库源“里面输入你想写的名称,我取名叫“[/font][font=Times New Roman]ABC[/font][font=宋体]”[/font][font=Times New Roman],[/font][font=宋体]说明不需要填,接着,按下面的选择,寻找你的数据库地址和选中(注意,请先备份自己的[/font][font=Times New Roman]ACCESS[/font][font=宋体]数据库),然后确定。[/font][font=Times New Roman]
[/font][/color][/size]
[size=3][color=#000000][font=Times New Roman] [/font][font=宋体]数据源在这里建好了,剩下转换了。[/font][font=Times New Roman]
[/font][/color][/size]
[size=3][color=#000000][font=Times New Roman]
[/font][/color][/size]
[size=3][color=#000000][font=Times New Roman]
3[/font][font=宋体],打开[/font][font=Times New Roman]SQL2000[/font][font=宋体]企业管理器,进入数据库,新建一个空的数据库“[/font][font=Times New Roman]ABC[/font][font=宋体]”;[/font][font=Times New Roman]
[/font][/color][/size]
[size=3][color=#000000][font=Times New Roman]
4[/font][font=宋体],选择新建立的数据库,按鼠标右键,选择“所有任务”下“导入数据”,按“下一步”继续;[/font][font=Times New Roman]
[/font][/color][/size]
[size=3][color=#000000][font=Times New Roman]
5[/font][font=宋体],在数据库源下拉但中选择”[/font][font=Times New Roman]Driver do microsoft Access(*.mdb)[/font][font=宋体]“,在”用户[/font][font=Times New Roman]/[/font][font=宋体]系统[/font][font=Times New Roman]DSN[/font][font=宋体]“中,选种你刚才添加的”[/font][font=Times New Roman]ABC[/font][font=宋体]“,按[/font][font=Times New Roman] [/font][font=宋体]”下一步“;[/font][font=Times New Roman]
[/font][/color][/size]
[size=3][color=#000000][font=Times New Roman]
6[/font][font=宋体],“目的”不需要修改,选择服务器(一般下为自己的本机[/font][font=Times New Roman]"local",[/font][font=宋体]也可以选择服务器地址或者局域网地址[/font][font=Times New Roman],[/font][font=宋体]确定你的权限是否可以操作[/font][font=Times New Roman],),"[/font][font=宋体]使用[/font][font=Times New Roman]WINDOWS [/font][font=宋体]身份验证[/font][font=Times New Roman]"[/font][font=宋体]指用自己的系统管理员身份操作[/font][font=Times New Roman],"[/font][font=宋体]使用[/font][font=Times New Roman]SQL[/font][font=宋体]身份操作验证[/font][font=Times New Roman]"[/font][font=宋体]可以用于网站的操作[/font][font=Times New Roman],[/font][font=宋体]推荐用后者[/font][font=Times New Roman];
[/font][/color][/size]
[size=3][color=#000000][font=Times New Roman]
7,[/font][font=宋体]选上[/font][font=Times New Roman]"[/font][font=宋体]使用[/font][font=Times New Roman]SQL[/font][font=宋体]身份操作验证[/font][font=Times New Roman]"[/font][font=宋体]后[/font][font=Times New Roman],[/font][font=宋体]填写你的用户名和密码[/font][font=Times New Roman],[/font][font=宋体]我自己选择的是系统默认号码[/font][font=Times New Roman]"sa","****",[/font][font=宋体]数据库选择刚新建的[/font][font=Times New Roman]"ABC",[/font][font=宋体]按[/font][font=Times New Roman]"[/font][font=宋体]下一步[/font][font=Times New Roman]";
[/font][/color][/size]
[size=3][color=#000000][font=Times New Roman]
8,[/font][font=宋体]这一步的两个单项选择[/font][font=Times New Roman],"[/font][font=宋体]从数据源复制表和视图[/font][font=Times New Roman]"[/font][font=宋体]与[/font][font=Times New Roman]"[/font][font=宋体]用一条查询指令指定要传输的数据[/font][font=Times New Roman]",[/font][font=宋体]选择前者[/font][font=Times New Roman],[/font][font=宋体]按[/font][font=Times New Roman]"[/font][font=宋体]下一步[/font][font=Times New Roman]"[/font][font=宋体]继续[/font][font=Times New Roman];
[/font][/color][/size]
[size=3][color=#000000][font=Times New Roman]
9,[/font][font=宋体]这里将出现你自己[/font][font=Times New Roman]ACCESS[/font][font=宋体]数据库的表[/font][font=Times New Roman],[/font][font=宋体]按[/font][font=Times New Roman]"[/font][font=宋体]全选[/font][font=Times New Roman]"[/font][font=宋体]后[/font][font=Times New Roman],[/font][font=宋体]下一步[/font][font=Times New Roman];
[/font][/color][/size]
[size=3][color=#000000][font=Times New Roman]
10,"DTS[/font][font=宋体]导入[/font][font=Times New Roman]/[/font][font=宋体]导出向导[/font][font=Times New Roman]",[/font][font=宋体]看[/font][font=Times New Roman]"[/font][font=宋体]立即运行[/font][font=Times New Roman]"[/font][font=宋体]被选中按[/font][font=Times New Roman]"[/font][font=宋体]下一步[/font][font=Times New Roman]",
[/font][/color][/size]
[size=3][color=#000000][font=Times New Roman]
11,[/font][font=宋体]按[/font][font=Times New Roman]"[/font][font=宋体]完成[/font][font=Times New Roman]"[/font][font=宋体]继续[/font][font=Times New Roman];
[/font][/color][/size]
[size=3][color=#000000][font=Times New Roman]
12,[/font][font=宋体]这个步骤你将看到你的数据被导入[/font][font=Times New Roman]SQL2000[/font][font=宋体]里面[/font][font=Times New Roman],[/font][font=宋体]当出现[/font][font=Times New Roman]"[/font][font=宋体]已经成功把[/font][font=Times New Roman]XXX[/font][font=宋体]个表导入到数据库[/font][font=Times New Roman]"[/font][font=宋体]的字样[/font][font=Times New Roman],[/font][font=宋体]而且所有的表前面都有绿色的勾[/font][font=Times New Roman],[/font][font=宋体]就表示成功导入所有数据[/font][font=Times New Roman],[/font][font=宋体]如果中途出现问题或者表前面有红色的叉的话[/font][font=Times New Roman],[/font][font=宋体]说明该表没有成功导入[/font][font=Times New Roman],[/font][font=宋体]这时就要回去查看自己的操作是否正确了[/font][font=Times New Roman].
[/font][/color][/size]
[size=3][color=#000000][font=Times New Roman]
[/font][/color][/size]
[size=3][color=#000000][font=Times New Roman][/font][font=宋体]三[/font][font=Times New Roman],[/font][font=宋体]数据修改[/font][font=Times New Roman] [/font][/color][/size]
[size=3][color=#000000][font=Times New Roman]1,[/font][font=宋体]由于[/font][font=Times New Roman]SQL2000[/font][font=宋体]里面没有[/font][font=Times New Roman]"[/font][font=宋体]自动编号[/font][font=Times New Roman]",[/font][font=宋体]所以你的以[/font][font=Times New Roman]"[/font][font=宋体]自动编号[/font][font=Times New Roman]"[/font][font=宋体]设置的字段都会变成非空的字段[/font][font=Times New Roman],[/font][font=宋体]这就必须手工修改这些字段[/font][font=Times New Roman],[/font][font=宋体]并把他的[/font][font=Times New Roman]"[/font][font=宋体]标示[/font][font=Times New Roman]"[/font][font=宋体]选择[/font][font=Times New Roman]"[/font][font=宋体]是[/font][font=Times New Roman]",[/font][font=宋体]种子为[/font][font=Times New Roman]"1",[/font][font=宋体]增量为[/font][font=Times New Roman]"1",
[/font][/color][/size]
[size=3][color=#000000][font=Times New Roman]
2,[/font][font=宋体]另外[/font][font=Times New Roman],ACCESS2000[/font][font=宋体]转换成[/font][font=Times New Roman]SQL2000[/font][font=宋体]后[/font][font=Times New Roman],[/font][font=宋体]原来属性为[/font][font=Times New Roman]"[/font][font=宋体]是[/font][font=Times New Roman]/[/font][font=宋体]否[/font][font=Times New Roman]"[/font][font=宋体]的字段将被转换成非空的[/font][font=Times New Roman]"bit",[/font][font=宋体]这时候你必须修改成自己想要的属性了[/font][font=Times New Roman];
[/font][/color][/size]
[size=3][color=#000000][font=Times New Roman]
3,[/font][font=宋体]另外[/font][font=Times New Roman],[/font][font=宋体]大家要注意对时间函数的把握[/font][font=Times New Roman].ACCESS[/font][font=宋体]与[/font][font=Times New Roman]SQL[/font][font=宋体]是有很多不同的[/font][font=Times New Roman].
[/font][/color][/size] 学习了,楼主辛苦了!!!
页:
[1]