Sql查询使其预执行 [英] Sql query to make it pre-executed

查看:282
本文介绍了Sql查询使其预执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Friends,



我在互联网上搜索得足够多但无法得到我想要的结果。



我关心的是,有没有办法在SQL中进行查询,让sql自己执行它?b
$什么时候我想要结果一些我怎么能得到存储过程的结果当时没有运行它。



EG:让我说我想要ABC表中所有行的数量



所以在某个地方我想写一个查询

Hello Friends,

I have searched enough on internet but could not get a result of what i am looking for.

My concern is that Is there any way to make a query in SQL and let sql execute it itself
and when ever i want result some how i could get result in Stored Procedure with out running it at that time.

E.G.: Lets say I want count of all rows from ABC table

so somewhere i want to write a query

Select count(*) From ABC





然后在存储过程中我想要最新的表行数,而不是在那时运行此查询。当我在我的存储过程中运行查询时。



提前致谢



祝你好新年快乐....

推荐答案





如果你想要预先计算的结果是SQL Server,你不是OLTP模型,但是你正在使用OLAP(数据仓库)。



唯一预先计算的结果是在DMV中视图(对于OLTP数据库)

http://msdn.microsoft.com/ en-us / library / ms188754.aspx [ ^ ]



对于可以使用的表计数行:

Hi,

If you want pre-calculated result is SQL Server, you are not in OLTP model, but you are using OLAP (Data Warehousing).

The only pre-calculated result is in DMV views (for OLTP Database)
http://msdn.microsoft.com/en-us/library/ms188754.aspx[^]

For table count rows you can use :
select rows from sys.partitions where object_name(object_id) = 'ABC'





你也可以在SQL Server for OLTP中使用名为'StreamInsight'的新功能

http://technet.microsoft.com/fr-fr/library/ee362541%28v=sql.111%29.aspx [ ^ ]



当您的枚举条件为真时,此功能允许向ASP客户端(使用SingalR)提出回叫事件。



希望有帮助,
$ b $bBéchir。



You can use also new feature in SQL Server for OLTP called 'StreamInsight'
http://technet.microsoft.com/fr-fr/library/ee362541%28v=sql.111%29.aspx[^]

This feature allows raising call back event to the ASP client(Using SingalR), when your enumerated conditions is true.

Hope that help,
Béchir.


这篇关于Sql查询使其预执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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