存储过程中的多个查询 [英] multiple queries in a stored procedure

查看:110
本文介绍了存储过程中的多个查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hai

我必须选择语句

从emp中选择*;
从emp中选择count(*):

我如何将这两个语句放在一个存储过程中?

hai

i have to select statements

select * from emp;
select count(*) from emp:

how can i put this two statements in a single storedprocedure

推荐答案

嗨普拉萨德

假设您正在使用sql server,这是东西

创建proc测试

开始
Hi Prasad

Assuming you are using sql server, here is the thing

Create proc test
as
begin
select * from emp
select count(*) from emp


结束

希望对您有所帮助....


end

Hope this helps....


您好

检查一下.


http://shan-tech.blogspot.com/2005/08/sql-server-stored-procedures-returning.html [ ^ ]

可以肯定地为您提供帮助
Hello

Check this out.


http://shan-tech.blogspot.com/2005/08/sql-server-stored-procedures-returning.html[^]

This will help you for sure


您可以在select中包含count语句,

从emp中选择*,COUNT(*)OVER()AS RecordCount
You can include count statement in select,

select *,COUNT(*) OVER () AS RecordCount from emp


这篇关于存储过程中的多个查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆