很多朋友想用SQL2000数据库的编程方法,但是却又苦于自己是学ACCESS的,对SQL只是一点点的了解而已,这里我给大家提供以下参考---将ACCESS转化成SQL2000的方法和注意事项 一,首先,我说的是在ACCESS2000,SQL2000之间转换,其他的我也还没有尝试过,希望大家多多试验,肯定是有办法的; 二,转换的方法 1,打开”控制面板“下”管理工具“中的”数据库源“; 2,按”添加“添加一个新的数据源,在选择栏里选”Driver do microsoft Access (*.mdb)”,完成后将出现一个框,
PubSubJectAccCopys(Copy_id,Acc_id,Acc_Pid,Acc_name,acc_short,Acc_Comment,Acc_Pro,acc_type,Sub_id_flag,acc_index) (SELECT 200201,Acc_id,Acc_Pid,Acc_name,acc_short,Acc_Comment,Acc_Pro,acc_type,Sub_id_flag,acc_index FROM PubSubJectAcc WHERE PubSubJectAcc.co_type='03')
PubSubJectAccCopys(Copy_id,Acc_id,Acc_Pid,Acc_name,acc_short,Acc_Comment,Acc_Pro,acc_type,Sub_id_flag,acc_index) SELECT 200201,Acc_id,Acc_Pid,Acc_name,acc_short,Acc_Comment,Acc_Pro,acc_type,Sub_id_flag,acc_index FROM PubSubJectAcc WHERE PubSubJectAcc.co_type='03'
在SQL SERVER 中都可以
2、 Inner Join 语句1
StrSql:='select a.user_id,a.user_opcode,b.copy_name from sysuser a inner join (syscopysuser c inner join syscopys b on c.copy_id=c.copy_id) on a.user_id=c.user_id where
a.user_opcode=''' +EdtUserOpCode.text+''' And copy_name='''+Tmpcopyname +'''';
应该改为
StrSql:='select a.user_id,a.user_opcode,b.copy_name from sysuser a inner join (syscopysuser c inner join syscopys b on c.copy_id=d.copy_id) on a.user_id=c.user_id where
a.user_opcode=''' +EdtUserOpCode.text+''' And copy_name='''+Tmpcopyname +'''';
StrSql:='select copy_year,copy_name,a.copy_id from SysCopys a inner join SysCopysUser b on a.curcopy_flag=1 and a.copy_id=b.copy_id where b.user_id=' + '''' +TmpPubUserID+ '''';
该为
StrSql:='select copy_year,copy_name,a.copy_id from SysCopys a inner join SysCopysUser b on a.copy_id=b.copy_id where a.curcopy_flag=''1'' and b.user_id=' + '''' +TmpPubUserID+ '''';
注:两种写法都能在SQL-SERVER中运行,但第一种在ACCESS中不能运行
4、 Inner Join语句3
SQl server 中可以执行以下语句
'SELECT distinct sysoption.opti_id,sysoption.opti_name,sysoption.opti_code,sysroleoption.opti_sort From sysoption inner join sysroleoption ON sysoption.opti_id=sysroleoption.opti_id AND sysroleoption.role_id=:roleid'
但ACCESS中不能,只能
'SELECT distinct sysoption.opti_id,sysoption.opti_name,sysoption.opti_code,sysroleoption.opti_sort From sysoption inner join sysroleoption ON sysoption.opti_id=sysroleoption.opti_id Where sysroleoption.role_id=:roleid'
5、 Update语句
Sql SerVer 中能执行但Access 中不能
'UPDATE sysuserrole SET sysuserrole.role_sort = (SELECT sysrole.role_sort FROM sysrole WHERE sysuserrole.role_id = sysrole.role_id and sysuserrole.user_id='01')'