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的更多相关文章

  1. 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 ...

  2. golang illegal base64 data at input byte

    //one reason is whitespace ciphertext = strings.Replace(ciphertext, " ", "", -1) ...

  3. PatentTips - Data Plane Packet Processing Tool Chain

    BACKGROUND The present disclosure relates generally to systems and methods for providing a data plan ...

  4. 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 ...

  5. 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 ...

  6. [LeetCode] Data Stream as Disjoint Intervals 分离区间的数据流

    Given a data stream input of non-negative integers a1, a2, ..., an, ..., summarize the numbers seen ...

  7. jquery判断多个input输入框不能输入相同的值

    function checkName(data){ //校验联系信息不能一致 var values=""; $(".t").each(function(i,it ...

  8. TRANSPOSE的DATA步实现

    data a; input name $ a b ; cards; x x x y y y ; run; %macro transpose; proc sql noprint ; select cou ...

  9. 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 ...

随机推荐

  1. FlatList 核心运用

    <FlatList data={this.state.stuList} renderItem={this._renderItem} keyExtactor={this._keyExtractor ...

  2. java 对小数位的处理 BigDecimal DecimalFormat 常用操作 浅解

    [博客园cnblogs笔者m-yb原创, 转载请加本文博客链接,笔者github: https://github.com/mayangbo666,公众号aandb7,QQ群927113708] htt ...

  3. 关于python那些事儿

    学习总结: 1.输入一个数据 a=input. 2.在输出结果中增加字符 # 运行如下语句: print("你的名字叫{}.".format("饺子")) (以 ...

  4. Devexpress的DateEdit控件中DateTime与EditValue异同

    相同: 两者值相同,改变一个值都会引起另一个值做出相应改变. 不同: 1:在界面上对控件的编辑框进行操作时,EditValueChanged事件先响应,DateTimeChanged事件后响应. 2: ...

  5. ionic3样例应用

    https://github.com/jujunjun/ionic3-study 该应用包括的样例内容有: 文件上传,上拉更新,下拉加载,弹出层,列表,加载中,栅格,按钮等. php提供的文件上传接口 ...

  6. java.lang.NoSuchMethodError: org.springframework.util.StreamUtils.emptyInput()Ljava/io/InputStream;

    今天写用spring的MockMvc测试controller的demo时出现了这个错误,条件反射的进行了百度,没有搜到匹配的答案,但给了一些解决问题的思路:首先NoSuchMethodError要不就 ...

  7. 单例模式 | 程序员都想要探索的 Javascript 设计模式

    最近打算系统的学习 Javascript 设计模式,以便自己在开发中遇到问题可以按照设计模式提供的思路进行封装,这样可以提高开发效率并且可以预先规避很多未知的问题. 先从最基本的单例模式开始 什么是单 ...

  8. ueditor的用法

    今天做了一下百度富文本编辑器,遇到了一些问题,现在来总结一下: (1)jQuery没有引用,解决方法:引用jQuery并且放在所有的js前面 (2)没有报错,但是样式显示不出来.解决方法:css引用的 ...

  9. python基础15上_迭代器_生成器

    # 迭代器和生成器 # 迭代器: # 双下方法 : 很少直接调用的方法.一般情况下,是通过其他语法触发的 # 可迭代的 —— 可迭代协议 含有__iter__的方法('__iter__' in dir ...

  10. OpenGL绘制一个四边形

    学习自:https://learnopengl-cn.github.io/01%20Getting%20started/04%20Hello%20Triangle/ OpenGL没有直接绘制四边形的a ...