各位用户为了找寻关于SQL SERVER调用存储过程小结的资料费劲了很多周折。这里教程网为您整理了关于SQL SERVER调用存储过程小结的相关资料,仅供查阅,以下为您介绍关于SQL SERVER调用存储过程小结的详细内容

在SQL Server数据库的维护或者Web开发中,有时需要在存储过程或者作业等其他数据库操作中调用其它的存储过程,下面介绍其调用的方法

一、SQL SERVER中调用不带输出参数的存储过程

SQL 代码

? 1 2 3 4 5 6 7 8 9 10 11 12 --存储过程的定义 create procedure [sys].[sp_add_product] (   @m_viewcount int = 0  ,@m_hotcount int = 0 ) as go --存储过程的调用  declare @m_viewcount int  declare @m_hotcount int  exec sp_add_product @m_viewcount,@m_hotcount

二、SQL SERVER中调用带输出参数的存储过程

SQL 代码

? 1 2 3 4 5 6 7 8 9 10 --定义存储过程 create procedure [sys].[sp_add_product] (   @m_viewcount int = 0  ,@m_hotcount int output ) --存储过程的调用 declare @m_viewcount int =0 declare @m_hotcount int exec dbo.sp_add_product @m_viewcount,@m_hotcount output

ps:下面给大家介绍sql server 查找某个字段在哪些表中存在

如果数据库的命名是比较规范的,当我们需要查找某个字段在哪些表中存在时,在sql server中就很方便的利用syscolumns系统表查询出结果。

下面一段sql代码给大家讲解sql server 查找 m_Id 在哪些表中存在的方法

? 1 2 3 4 5 select tab.name table_name, col.name column_name  from sysobjects tab  left join syscolumns col on tab.id = col.id and tab.xtype = 'U'  where col.name like '%m_Id%'  order by 1,2

以上所述就是本文的全部叙述,希望大家喜欢。