SQL SERVER调用存储过程小结

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

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

sql 代码

rush:sql;"> --存储过程的定义 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 代码

rush:sql;"> --定义存储过程 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

sql server 查找某个字段在哪些表中存在

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

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

rush:sql;"> 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

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

相关文章

SELECT a.*,b.dp_name,c.pa_name,fm_name=(CASE WHEN a.fm_n...
if not exists(select name from syscolumns where name=&am...
select a.*,pano=a.pa_no,b.pa_name,f.dp_name,e.fw_state_n...
要在 SQL Server 2019 中设置定时自动重启,可以使用 Window...
您收到的错误消息表明数据库 'EastRiver' 的...
首先我需要查询出需要使用SQL Server Profiler跟踪的数据库标...