请问如何执行SQL语句?

xwj1003 2003-08-22 07:05:30
我想把select count(*) from table1 这句SQL得到记录数存放在变量 ss 里。怎么做?
...全文
24 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
thelazyman 2003-09-16
  • 打赏
  • 举报
回复
在pb中:
long ss
select count(*) into :ss from table;

注意在嵌入式的sql语句中,要在变量前加冒号,语句后要有分号!!
btlxy 2003-09-16
  • 打赏
  • 举报
回复
同意runsoft(清风)
eminena 2003-09-16
  • 打赏
  • 举报
回复
看一下 PB 的嵌入式 SQL 语句.
wwwafa9 2003-09-16
  • 打赏
  • 举报
回复
阿毛说得不错,就是那样的
注意在pb中,句末要加分号(;)
liujiaqiang 2003-08-22
  • 打赏
  • 举报
回复
你是在pb原代码中就直接写 select count(*) into :ss from table .
如果是在数据库中,比如在触发器或者存储过程中,就用:
select @ss= count(*) from table.
xwj1003 2003-08-22
  • 打赏
  • 举报
回复
如何执行select count(*) into :ss from table?
用exec?
runsoft 2003-08-22
  • 打赏
  • 举报
回复
PB
select count(*) into :ss from table

SQLSERVER
declare @ss integer
select @ss= count(*) from table

752

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧