怎样把excel数据导入epidata数据库

2024-11-19 04:20:00
推荐回答(1个)
回答(1):

SQLcodeTransact-SQL语句进行导入导出:1.在SQLSERVER里查询access数据:--======================================================SELECT*FROMOpenDataSource('Microsoft.Jet.OLEDB.4.0','DataSource="c:\DB.mdb";UserID=Admin;Password=')...表名select*fromopendatasource('Microsoft.Jet.OLEDB.4.0','DataSource="D:\db.mdb";UserID=Admin;Password=')...Studentwherename='我'select*fromnewTable-------------------------------------------------------------------------------------------------2.将access导入SQLserver--======================================================在SQLSERVER里运行:SELECT*INTOnewtableFROMOPENDATASOURCE('Microsoft.Jet.OLEDB.4.0','DataSource="c:\DB.mdb";UserID=Admin;Password=')...表名-------------------------------------------------------------------------------------------------3.将SQLSERVER表里的数据插入到Access表中--======================================================在SQLSERVER里运行:insertintoOpenDataSource('Microsoft.Jet.OLEDB.4.0','DataSource="c:\DB.mdb";UserID=Admin;Password=')...表名(列名1,列名2)select列名1,列名2fromsql表实例:insertintoOPENROWSET('Microsoft.Jet.OLEDB.4.0','C:\db.mdb';'admin';'',Test)selectid,namefromTestINSERTINTOOPENROWSET('Microsoft.Jet.OLEDB.4.0','c:\trade.mdb';'admin';'',表名)SELECT*FROMsqltablenameinsertintoOpenDataSource('Microsoft.Jet.OLEDB.4.0','DataSource="D:\db.mdb";UserID=Admin;Password=')...Student(studentid,name)selectstaffid,namefromstaffinsertintoOPENROWSET('Microsoft.Jet.OLEDB.4.0','D:\db.mdb';'admin';'',Student)selectaccountid,namefromtblbaccountselect*fromopenrowset('Microsoft.Jet.OLEDB.4.0','D:\db.mdb';'admin';'',Student)-------------------------------------------------------------------------------------------------二、SQLSERVER和EXC