用户名:
密 码: 记住
您当前的位置:首页 > 网络编程 > sqlserver教程

SQL转ACCESS解决自动编号问题

时间:2014-11-30  来源:互联网  作者:佚名

1.打开SQL(SQL Server培训 mySQL培训 ) server enterprise mananger "企业管理器"

在你要导出的SQL数据库上鼠标右键菜单:所有任务-》导出数据

screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}

}" border="0" />

2.回出现一个导出向导窗口。

选择被导出的数据源,为你刚才所选择的数据库,如果发现不对应自行修改。

screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}

}" border="0" />

3.进入导出到目标数据源的选择,这里我们要转成Access(Access培训 )的数据库。注意选择数据源类型为“Microsoft Access。点 “文件名(F)” 后面的按钮选择目标.MDB文件。

screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}

}" border="0" />

screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}

}" border="0" />

4.选择“从数据库复制表和视图”。

screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}

}" border="0" />

5.我们注意这里选表的时候右边有一个“转换”列。SQL导出只转换数据类型并不考虑其他脚本所以我们遇到的自动编号问题也就出在这里。有自动编号的一定要点选“转换”。

screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}

}" border="0" />

6.我们回看到一个“列映射和转换”对话框。有注意到自增的employeeid int 自增这里变成了Access里的long这肯定不对,long并不是自动编号,只好修改建表脚本,图片上那个红圈里的按钮“编辑SQL”。

screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}

}" border="0" />

开一个小窗create talbe

screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}

}" border="0" />

红圈中的脚本就是employeeid 的 Access建表脚本,在 "NOT NULL" 前面加上 "IDENTITY (1, 1)"。

screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}

}" border="0" />

7.立即执行。

screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}

}" border="0" />

下图表示建表复制已成功

screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}

}" border="0" />

8.我们打开MDB文件看看是不是如我们所愿?

screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}

}" border="0" />

OK完成,恭喜你操作成功。

来顶一下
返回首页
返回首页
推荐资讯
从零开始学ASP.NET-基础篇第1/7页 从零开始学ASP.NET-基础篇第1/7页第一天 学习目的: 掌握最基本的Label、TextBox、Button控件
ASP.NET入门数据篇 ASP.NET入门数据篇对于网站编程的初学者来说,总是会上网找些源码来看,但久而
相关文章
栏目更新
栏目热门