vba data to input tool
public Sub InserDb()
dim maxrow as integer
dim maxcol as integer
dim ddl as string
dim recode as string
dim recodes as string
dim sheetname as string
dim tablename as string
sheetname = "data"
tablename = sheets(sheetname).cells(1,2).value
maxrow = sheets(sheetname).cells(rows.count,1).end(xlup).row
maxcol = sheets(sheetname).cells(2,columns.count).end(xltoleft).column
for i = 1 to maxcol
if i = 1 then
ddl = sheets(sheetname).cells(2,i).value
else
ddl = ddl + "," + sheets(sheetname).cells(2,i).value
end if
next
for j = 3 to maxrow
for k = 1 to maxcol
if k = 1 then
recode = "(" & "'" & sheets(sheetname).cells(j,k).value & "'"
else
if sheets(sheetname).cells(j,k).value = "" then
recode = recode & "," & "NULL"
else
recode = recode & "," & "'" & sheets(sheetname).cells(j,k).value & "'"
end if
end if
next
sheets("output").cells(j-1,1).value = "insert into" & tablename & "(" & dll & ")" & "values" & recode + ");"
next
sheets("output").cells(1,1).value = "TRUNCATE" & tablename & ";"
sheets("output").select
end sub
vba data to input tool的更多相关文章
- sc.textFile("file:///home/spark/data.txt") Input path does not exist解决方法——submit 加参数 --master local 即可解决
use this val data = sc.textFile("/home/spark/data.txt") this should work and set master as ...
- golang illegal base64 data at input byte
//one reason is whitespace ciphertext = strings.Replace(ciphertext, " ", "", -1) ...
- PatentTips - Data Plane Packet Processing Tool Chain
BACKGROUND The present disclosure relates generally to systems and methods for providing a data plan ...
- DATA VISUALIZATION – PART 2
A Quick Overview of the ggplot2 Package in R While it will be important to focus on theory, I want t ...
- What is Data Driven Testing? Learn to create Framework
What is Data Driven Testing? Data-driven is a test automation framework which stores test data in a ...
- [LeetCode] Data Stream as Disjoint Intervals 分离区间的数据流
Given a data stream input of non-negative integers a1, a2, ..., an, ..., summarize the numbers seen ...
- jquery判断多个input输入框不能输入相同的值
function checkName(data){ //校验联系信息不能一致 var values=""; $(".t").each(function(i,it ...
- TRANSPOSE的DATA步实现
data a; input name $ a b ; cards; x x x y y y ; run; %macro transpose; proc sql noprint ; select cou ...
- Leetcode: Data Stream as Disjoint Intervals && Summary of TreeMap
Given a data stream input of non-negative integers a1, a2, ..., an, ..., summarize the numbers seen ...
随机推荐
- JAVA如何request没有参数的post提交
过去做网页的时候 post过来的值都是带参的 我就request.getParameter("")来获取 现在过来的不带参 就一串字符串 我应该怎么获取? //用获取数据流的方式, ...
- python学习------面向对象的程序设计
一 面向对象的程序设计的由来 1940年以前:面向机器 最早的程序设计都是采用机器语言来编写的,直接使用二进制码来表示机器能够识别和执行的指令和数 据.简单来说,就是直接编写 和 的序列来代表程序语言 ...
- Java中的异常处理与抛出
一.异常处理 程序运行过程中出现的,导致程序无法继续运行的错误叫做异常. Java中有多种异常,所有异常的父类是Throwable,他主要有两个子类Error和Exception. Error一般是J ...
- Touch事件分发源码解析
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 以下源码基于Gingerbread 2.3.7 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1.先看ViewGroup的di ...
- mybatis 报The content of elements must consist of well-formed character data or markup. 语法格式错误
最近在写sql的时候 同时使用到了 >= 和 <= 之前只使用一个的时候 没有什么问题,今天同时使用到了两个,结果xml出现了The content of elements must co ...
- input 特殊字符限制
ng-pattern="/^[A-Za-z0-9_,\.\u4e00-\u9fa5\s]+$/"
- Python基础-Python的三元运算符和lambda表达式
1. Python的三元表达式: 现在大部分高级语言都支持 “?”这个三元运算符,它对应的表达式如下:condition ? value if true:value if else 但是 Python ...
- 什么是 SaaS (Software as a Service)
什么是SaaS (Software as a service ) 把软件作为一个服务.SaaS是一种cloud-based 和通过Internet提供软件的模式,用户不用再购买软件,而改用向提供商租用 ...
- redis的特点
一.Redis 特点 1.Redis 是一个基于内存的高性能key-value数据库, 2.Redis最大的魅力是支持保存多种数据结构,此外单个value的最大限制是1GB,不像 memcached只 ...
- participation remain wide
Equal access to universities stagnates Image copyright Getty Images The most advantaged teens have t ...