环境:PB9.0,sqlserver2005
在PB中,以下两个SQL语句如何实现啊?
(1) select * into newtablename from oldtablename where ... //以现有表数据创建新表
(2) delete from tablename where ... //从一个表中删除数据
谢谢~
------解决方案--------------------
楼主问的怎么实现什么意思啊?
string vssql
vssql = “ select * into newtablename from oldtablename where ... ”
EXECUTE IMMEDIATE :vssql ;
或者
string new_syntax
new_syntax = SQLCA.syntaxfromsql(vssql,'Style(Type=grid)', error_syntaxfromSQL) if len(error_syntaxfromSQL) > 0 then
messagebox("错误提示",error_syntaxfromSQL)
else
dstable.create(new_syntax, error_create)
if len(error_create) > 0 then
messagebox("错误提示",error_create)
end if
end if
------解决方案--------------------
string ls_sql
ls_sql=" select * into newtablename from oldtablename where ... ;"
EXECUTE IMMEDIATE :ls_sql ;
if sqlca.sqlcdoe = 0 then
commit;
else
rollback;
end if
;第二个直接写后面加分号即可
delete from tablename where ... ;
if sqlca.sqlcdoe = 0 then
commit;
else
rollback;
end if