In the maintenance of SQL Server databases or Web development, it is sometimes necessary to invoke other stored procedures in other database operations, such as stored procedures or jobs, as described in the following methods of their invocation
A stored procedure called without an output parameter in SQL Server
SQL Code
--Definition of stored procedure
CREATE PROCEDURE [sys].[ Sp_add_product]
(
@m_viewcount int = 0
, @m_hotcount int = 0
) as Go
--call
to stored procedure DECLARE @m_viewcount int
declare @m_hotcount int
exec sp_add_product @m_viewcount, @m_hotcount
Second, call stored procedures with output parameters in SQL Server
SQL Code
--Define stored procedures
CREATE PROCEDURE [sys].[ Sp_add_product]
(
@m_viewcount int = 0
, @m_hotcount int output
)-
-Declare of the stored procedure call
@m_ Viewcount int =0
declare @m_hotcount int
exec dbo.sp_add_product @m_viewcount, @m_hotcount output
PS: Here is a description of SQL Server to find out which tables a field exists in
If the naming of a database is more canonical, it is convenient to use syscolumns system tables to query for results in SQL Server when we need to find out which tables a field exists in.
The following section of SQL code explains how SQL Server finds m_id in which tables.
Select Tab.name table_name, Col.name column_name from
sysobjects tab left
join syscolumns col on tab.id = col.id A nd tab.xtype = ' U '
where col.name like '%m_id% ' ORDER by
1,2
The above mentioned is the entire description of this article, I hope you like.