关于数据库object的有关问题
关于数据库object的问题
1.数据库的中的Views、store procedures、functions是保存在哪个表中?
2.是否可以批量修改数据库视图或存储过程的内容,例如将其views和store procedures中所有有的'prtest'的字符用'Updtest'代替,请问怎样写?
谢谢!
------解决方案--------------------
1.数据库的中的Views、store procedures、functions是保存在哪个表中?
2.是否可以批量修改数据库视图或存储过程的内容,例如将其views和store procedures中所有有的'prtest'的字符用'Updtest'代替,请问怎样写?
--> 将views和store procedures产生为代码文件,打开代码文件,
批量替换"prtest"为"Updtest",执行,更新.
------解决方案--------------------
找到这些对象的ID,然后去SELECT * FROM sys.system_sql_modules这里找
------解决方案--------------------
1.数据库的中的Views、store procedures、functions是保存在哪个表中?
2.是否可以批量修改数据库视图或存储过程的内容,例如将其views和store procedures中所有有的'prtest'的字符用'Updtest'代替,请问怎样写?
谢谢!
------解决方案--------------------
1.数据库的中的Views、store procedures、functions是保存在哪个表中?
select name 'ObjectName',
case xtype when 'V' then 'Views'
when 'P' then 'StoreProcedures'
when 'FN' then 'Functions' end 'ObjectType'
from sys.sysobjects
where xtype in('V','P','FN')
2.是否可以批量修改数据库视图或存储过程的内容,例如将其views和store procedures中所有有的'prtest'的字符用'Updtest'代替,请问怎样写?
--> 将views和store procedures产生为代码文件,打开代码文件,
批量替换"prtest"为"Updtest",执行,更新.
------解决方案--------------------
找到这些对象的ID,然后去SELECT * FROM sys.system_sql_modules这里找
------解决方案--------------------
select a.name 'ObjectName',
case a.xtype when 'V' then 'Views'
when 'P' then 'StoreProcedures'
when 'FN' then 'Functions' end 'ObjectType',
b.definition 'Script'
from sys.sysobjects a
inner join sys.sql_modules b on a.id=b.[object_id]
where a.xtype in('V','P','FN')