你可以使用循环和变量来实现递增的表名。下面是一个示例的shell脚本:

#!/bin/bash

for ((i=1; i<=10000; i++))
do
    table_name="test$i"
    qsql --connect "qianbase://qbadmin:qianbase@175.20.1.242:23400/ecas?sslmode=require" -e "create table xtptest.$table_name(id int,name varchar(32),CONSTRAINT \"primary\" PRIMARY KEY (id ASC));"
done

在这个脚本中,使用了一个循环来执行10000次命令。在每次循环中,使用变量i来构建递增的表名,然后执行qsql命令来创建表。

注意,我在脚本中对sslmode参数进行了修正,将其改为"require",并且对CONSTRAINT关键字进行了转义。

你可以将以上代码保存到一个文件(比如create_tables.sh),然后在终端中运行bash create_tables.sh来执行脚本。

编写一个循环执行10000次qsql --connect qianbaseqbadminqianbase17520124223400ecassslmode=requeire -e create table xtptesttest1id intname varchar32CONSTARINT primary PRIMARY KEY id ASC;并且每次将test1后的数字递增加一的shell脚本。

原文地址: https://www.cveoy.top/t/topic/i8Hv 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录