SQL SERVER调用存储过程小结
16lz
2022-01-08
在SQL Server数据库的维护或者Web开发中,有时需要在存储过程或者作业等其他数据库操作中调用其它的存储过程,下面介绍其调用的方法
一、SQL SERVER中调用不带输出参数的存储过程
SQL 代码
--存储过程的定义create procedure [sys].[sp_add_product] ( @m_viewcount int = 0 ,@m_hotcount int = 0)asgo --存储过程的调用 declare @m_viewcount int declare @m_hotcount int exec sp_add_product @m_viewcount,@m_hotcount
SQL 代码
--定义存储过程create procedure [sys].[sp_add_product] ( @m_viewcount int = 0 ,@m_hotcount int output )--存储过程的调用declare @m_viewcount int =0declare @m_hotcount int exec dbo.sp_add_product @m_viewcount,@m_hotcount output
如果数据库的命名是比较规范的,当我们需要查找某个字段在哪些表中存在时,在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
更多相关文章
- Android异步加载图像小结 (含线程池,缓存方法)
- android WebView 图片缩放功能小结
- Android(安卓)Camera 使用小结
- android fragment学习5--fragment扩展 TabLayout非自定义
- Android(安卓)电源系列小结s
- Android中自定义对话框小结
- Android中自定义对话框小结
- Android中自定义对话框小结
- Android中自定义对话框小结