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. Python编写的记事本小程序

    用Python中的Tkinter模块写的一个简单的记事本程序,Python2.x和Python3.x的许多内置函数有所改变,所以以下分为Python2.x和Python3.x版本. 一.效果展示: 二 ...

  2. flask 第七章 简陋版智能玩具 +MongoDB初识和基本操作

    1.简陋版web智能玩具 FAQ.py文件 import os from aip import AipSpeech, AipNlp from uuid import uuid4 "" ...

  3. Java作业:第二次过程性考核 ——长春职业技术学院 16级网络工程

    ## 时间有限,脑力不足 ## 只给出代码部分(附带注释) 码云 https://gitee.com/SoridoD/codes 7-5: import java.util.Scanner; clas ...

  4. 比较爬虫用的语言Python与Go

    Python是我比较喜欢的语言,莫名的喜欢,对Python的学习可能起初是敲错了网址开始的,哈哈哈~ 工作的任务从一个网站后台做登录.爬取数据,写入服务器Redis中,同事认为我会用PHP来写,哼!让 ...

  5. linux创建新用户,可以使用sudo无密码操作

    useradd -d /home/aiuap -m aiuappasswd aiuapXXXXXXXgroupadd aiuapchown -R aiuap:aiuap /home/aiuap chm ...

  6. Java虚拟机学习-对象的创建

    虚拟机遇到一条new指令时,首先将去检查这个指令的参数是否能在常量池中定位到一个类的符号引用,并且检查这个符号引用代表的类是否已经被加载.解析和初始化过.如果没有,必须先执行相应类的加载过程. 类加载 ...

  7. 1. nginx添加自定义http模块(简单)

    步骤 1. 新建模块目录2. 添加模块配置文件3. 编写模块源码文件4. 在主配置文件中配置访问location5. 编译加入模块文件6. 测试 新建模块目录 mkdir /opt/nginx/ext ...

  8. git clone 带用户名密码

    git使用用户名密码clone的方式: git clone http://username:password@remote eg: username:  abc@qq.com, pwd: test, ...

  9. 【转】QT 添加外部库文件

    转自:Qt 添加外部库文件 LIBS += D:\Code\Opengltest\OpenGL32.Lib D:\Code\Opengltest\GlU32.Lib # 直接加绝对路径 LIBS += ...

  10. (转)ArcGIS Runtime for Android 使用异步GP服务绘制等值线

    关于基于Android上ArcGIS Server GP服务的调用,已经有前辈给出了很好的例子: http://blog.csdn.net/esrichinacd/article/details/92 ...