您现在的位置是:网站首页> 编程资料编程资料
SQL SERVER调用存储过程小结_MsSql_
2023-05-26
352人已围观
简介 SQL SERVER调用存储过程小结_MsSql_
在SQL Server数据库的维护或者Web开发中,有时需要在存储过程或者作业等其他数据库操作中调用其它的存储过程,下面介绍其调用的方法
一、SQL SERVER中调用不带输出参数的存储过程
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 代码
--定义存储过程 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 在哪些表中存在的方法
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
以上所述就是本文的全部叙述,希望大家喜欢。
您可能感兴趣的文章:
相关内容
- 浅析SQL数据操作语句_MsSql_
- 日常收集整理SqlServer数据库优化经验和注意事项_MsSql_
- SQL Server将一列的多行内容拼接成一行的实现方法_MsSql_
- sqlserver四舍五入使用round函数及cast和convert函数_MsSql_
- SQL获取第一条记录的方法(sqlserver、oracle、mysql数据库)_MsSql_
- 数据库触发器DB2和SqlServer有哪些区别_MsSql_
- SqlServer异常处理常用步骤_MsSql_
- SQL语句执行顺序详解_MsSql_
- master数据库损坏的解决办法有哪些_MsSql_
- SQL SERVER 2014 安装图解教程(含SQL SERVER 2014下载)_MsSql_
