zoukankan
html css js c++ java
提取SQL脚本代码
public
static
IList
<
string
>
GenerateStoredProcedures()
{
int
i
=
0
;
IList
<
string
>
list
=
new
List
<
string
>
();
DBUitility db
=
new
DBUitility();
SqlConnection conn
=
db.CreateConnection(
@"
Data Source=.\sqlExpress;Initial Catalog=PBCS;Integrated Security=True
"
);
DataTable dt
=
db.GetDataAsDataTable(
"
select name, object_id from sys.objects where type='P' and charindex( '_', [name]) =0 and objectproperty(object_id,'IsProcedure' ) =1
"
);
foreach
(DataRow dr
in
dt.Rows)
{
string
id
=
dr[
"
object_id
"
].ToString();
string
name
=
dr[
"
name
"
].ToString();
DataTable dtText
=
db.GetDataAsDataTable(
string
.Format(
"
exec sp_helptext '{0}'
"
, name));
i
++
;
StringBuilder sb
=
new
StringBuilder();
sb.AppendLine(
string
.Format(
"
if exists (select * from dbo.sysobjects where id = object_id('[dbo].[{0}]') and OBJECTPROPERTY(id, 'IsProcedure') = 1)
"
, name));
sb.AppendLine(
"
begin
"
);
sb.AppendLine(
string
.Format(
"
drop procedure [dbo].[{0}]
"
, name));
sb.AppendLine(
"
end
"
);
sb.AppendLine(
"
go
"
);
sb.AppendLine();
bool
bStart
=
true
;
foreach
(DataRow drText
in
dtText.Rows)
{
if
(bStart
&&
drText[
0
].ToString().Trim()
!=
""
)
{
bStart
=
false
;
}
if
(
!
bStart)
{
sb.Append(drText[
0
].ToString());
}
}
sb.AppendLine();
sb.AppendLine(
"
go
"
);
sb.AppendLine();
Debug.AutoFlush
=
true
;
Debug.WriteLine(sb.ToString());
list.Add(sb.ToString());
}
conn.Dispose();
return
list;
}
public
static
IList
<
string
>
GenerateFunctions()
{
int
i
=
0
;
IList
<
string
>
list
=
new
List
<
string
>
();
DBUitility db
=
new
DBUitility();
SqlConnection conn
=
db.CreateConnection(
@"
Data Source=.\sqlExpress;Initial Catalog=PBCS;Integrated Security=True
"
);
DataTable dt
=
db.GetDataAsDataTable(
"
select name, object_id from sys.objects where type='TF' and charindex( '_', [name]) =0
"
);
foreach
(DataRow dr
in
dt.Rows)
{
string
id
=
dr[
"
object_id
"
].ToString();
string
name
=
dr[
"
name
"
].ToString();
DataTable dtText
=
db.GetDataAsDataTable(
string
.Format(
"
exec sp_helptext '{0}'
"
, name));
i
++
;
StringBuilder sb
=
new
StringBuilder();
sb.AppendLine(
string
.Format(
"
if exists (select * from dbo.sysobjects where id = object_id('[dbo].[{0}]'))
"
, name));
sb.AppendLine(
"
begin
"
);
sb.AppendLine(
string
.Format(
"
drop function [dbo].[{0}]
"
, name));
sb.AppendLine(
"
end
"
);
sb.AppendLine(
"
go
"
);
sb.AppendLine();
bool
bStart
=
true
;
foreach
(DataRow drText
in
dtText.Rows)
{
if
(bStart
&&
drText[
0
].ToString().Trim()
!=
""
)
{
bStart
=
false
;
}
if
(
!
bStart)
{
sb.Append(drText[
0
].ToString());
}
}
sb.AppendLine();
sb.AppendLine(
"
go
"
);
sb.AppendLine();
Debug.AutoFlush
=
true
;
Debug.WriteLine(sb.ToString());
list.Add(sb.ToString());
}
conn.Dispose();
return
list;
}
查看全文
相关阅读:
点击劫持漏洞之理解 python打造一个挖掘点击劫持漏洞的脚本
URL重定向漏洞,python打造URL重定向漏洞检测脚本
动态链接库(DLL)
vs不支持通过afxgetmainwnd()获取窗口句柄(转)
HALCON学习-下载、安装
HALCON学习-资料
MFC,ADO方式实现数据库操作
VS2010 EXCEL2010 表格操作的编程实现
Git Compare with base,比较大文件时,长时间等待,无法加载
VS2010编译VS2008工程时,LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt
原文地址:https://www.cnblogs.com/rockniu/p/753210.html
最新文章
常用的一些正则验证
银行卡号输入对应相应的发卡银行
[luogu P1967] 货车运输
[ZOJ1002] Fire Net
[UESTC 594] 我要长高
洛谷P2890 [USACO07OPEN]便宜的回文Cheapest Palindrome
YY的GCD
[POI2014]KAR-Cards
洛谷P1291 [SHOI2002]百事世界杯之旅
洛谷P5104 红包发红包
热门文章
洛谷P4550 【收集邮票】
洛谷P3388 【模板】割点(割顶)
php语法
php环境搭建
php介绍
文件包含漏洞进阶篇
python使用sqlmap API检测SQL注入
python 信息收集器和CMS识别脚本
Centos下的apache2练习
CSRF进阶之打造一个检测CSRF漏洞的脚本
Copyright © 2011-2022 走看看