首页 > 数据库 >SQL Server 批量导出存储过程、视图和函数

SQL Server 批量导出存储过程、视图和函数

时间:2023-08-19 14:12:50浏览次数:38  
标签:存储 AF object 视图 Server SQL type id

select a.name,a.[type],b.[definition] 
FROM sys.all_objects a,sys.sql_modules b 
where a.is_ms_shipped=0 and a.object_id = b.object_id and a.[type] in ('P','V','AF') 
order by a.[name] asc

当 type 为‘ P’ 时,为存储过程

当 type 为‘ V’ 时,为视图

当 type 为‘ AF’ 时,为函数

标签:存储,AF,object,视图,Server,SQL,type,id
From: https://www.cnblogs.com/shaopang/p/17642402.html

相关文章

  • Windows安装MySQL后怎么开启root的网络访问权限
    Windows安装MySQL后默认只能本机访问,怎么开启网络访问mysql>createuser'root'@'%'identifiedby'password';QueryOK,0rowsaffected(0.00sec)mysql>grantallon*.*to'root'@'%';QueryOK,0rowsaffected(0.00s......
  • Windows安装MySQL后怎么设置环境变量
    Windows安装MySQL后默认不会设置环境变量需要手动添加已Windows11为例我的电脑-右键-属性-高级系统设置选择环境变量Path选择编辑新建环境变量把MySQL的bin路径添加进去注意:Windows10使用下面的Path添加......
  • 【LeetCode1384. 按年度列出销售总额】MySQL使用with recursive根据开始日期和结束日
    题目地址https://leetcode.cn/problems/total-sales-amount-by-year/description/代码WITHRECURSIVEDateSeriesAS(SELECTproduct_id,period_startASsale_date,period_end,average_daily_salesFROMSales--Assumingyourtablenameissales_dataUN......
  • Sql server-自定义函数
    定义:一种方法1.创建函数,求该银行的金额总和--(没有参数,返回标量值)gocreatefunctiongetsumcardbalance()returnmoneyasbegindeclare@sumcardbalancemoneyset@sumcardbalance=(selectsum(cardbalance)frombankcard)return@sumcardbalance end2.调用验证select......
  • Visual Studio 2022 没有MySQLDatabase数据源
    解决办法: ①下载安装MySQLODBC驱动②运行ODBC数据源管理器③添加MySQL数据源,填入相应信息,测试通过即可④打开VS 工具>>连接到数据库,选择MicrosoftODBCDataSource⑤下拉列表中选择刚才新建的ODBC数据源,确定。       由此,在VS的侧边栏就可以对MySQL......
  • 【LeetCode2199. 找到每篇文章的主题】字符串处理题,使用MySQL里的group_concat和LOCAT
    题目地址https://leetcode.cn/problems/finding-the-topic-of-each-post/description/代码witht1as(selectp.*,k.*fromPostspleftjoinKeywordskonLOCATE(LOWER(CONCAT('',word,'')),LOWER(CONCAT('',conte......
  • 关于日常开发中的一些小的SQL优化建议
    优化建议:索引优化:根据查询条件和连接条件创建索引,可以提高查询性能(有连表查询时,连表关联字段添加上索引)。子查询优化:将子查询改为连接查询,可以提高查询性能。具体可以考虑将es_info_relation_owner表的子查询改为连接查询。避免使用DISTINCT关键字:如果查询结果中有重复的记录,可......
  • rhel 6.5以编译方式安装mysql 5.5.18
    文档课题:rhel6.5以编译方式安装mysql5.5.18数据库:mysql5.5.18系统:rhel6.564位安装包:mysql-5.5.18.tar.gz1、卸载MariaDB--卸载系统自带的mysql和mariadb-lib.[root@MySQL5518-Master~]#rpm-qa|grepmysqlmysql-libs-5.1.71-1.el6.x86_64[root@MySQL5518-Master~......
  • [SQL Server---For XML PATH 的运用]
    SELECTA.CID,B.TrueNameinto#UserNameFROMRH_CommuUserRoleAWITH(NOLOCK)LeftjoinRH_UserBWITH(NOLOCK)onA.UserID=B.idANDA.UType=1WHEREB.UserState=1selectCID,TrueName=STUFF((select','+ltrim(TrueName)from#UserNamewhereCID=t.CIDfo......
  • SQLserver批量批量导出索引
    WITHindexInfoas(SELECTSCHEMA_NAME(t.schema_id)[schema_name],t.nameas[table_name],t1.nameas[index_name],t1.type,t1.type_desc,t1.is_unique,t1.is_primary_key,t1.is_unique_constraint,t1.has_filter,t1.filter_definition,STUFF((SELECT�......