我有一个调用“sqlcmd”删除和创建过程命令的批处理文件,它仅在执行 bat 文件时工作正常。但是,当使用 iexpress(Windows 工具)将 .bat 文件转换为可执行文件时,应用程序无法运行并出现以下错误。
我尝试使用 iexpress 将“执行用于创建数据库的 sql 脚本的 bat 文件”转换为 exe,效果很好。但是 drop 和 create 过程命令都失败了。
我正在尝试使用 iexpress 工具从批处理文件创建一个 exe。在打包期间,所有依赖文件都包含在包中。我的问题是从“CreateProcedure.bat”创建 exe。建议和解决方案表示赞赏。
创建数据库.bat
set path=C:\Program Files (x86)\Microsoft SQL Server\Client
SDK\ODBC\110\Tools\Binn;%path%
sqlcmd -U sa -P texas#2019 -i CreateDB.sql
创建数据库.sql
GO
CREATE DATABASE TEX
ON
( NAME = TEX_Data,
FILENAME = 'C:\Program Files (x86)\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\TEX_Data.MDF',
SIZE = 500,
MAXSIZE = 500,
FILEGROWTH = 0 )
LOG ON
( NAME = TEX_Log,
FILENAME = 'C:\Program Files (x86)\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\TEX_Log.LDF',
SIZE = 250,
MAXSIZE = 250,
FILEGROWTH = 0 )
GO
USE TEX
GO
CREATE LOGIN texas WITH PASSWORD = 'texas',CHECK_POLICY = OFF
GO
USE TEX
GO
sp_adduser 'texas'
GRANT
BACKUP DATABASE,
BACKUP LOG,
CREATE DEFAULT,
CREATE FUNCTION,
CREATE PROCEDURE,
CREATE RULE,
CREATE TABLE,
CREATE VIEW
TO iris;
ALTER DATABASE TKO SET RECOVERY SIMPLE
GO
CreateProcedure.bat
USE master
sqlcmd -U texas -P texas -Q "drop table staging"
sqlcmd -U texas -P texas -Q "drop procedure sp_staging_old"
sqlcmd -U texas -P texas -Q "drop procedure sp_import"
sqlcmd -U texas -P texas -Q "drop procedure sp_import_from_old"
sqlcmd -U texas -P texas -Q "drop procedure sp_staging"
sqlcmd -U texas -P texas -Q "drop procedure sp_export"
sqlcmd -U texas -P texas -Q "drop procedure sp_import_no_TEX"
sqlcmd -U texas -P texas -Q "drop procedure sp_import_4_TEX"
sqlcmd -U texas -P texas -Q "drop procedure sp_staging_no_TEX"
sqlcmd -U texas -P texas -Q "drop procedure sp_staging_4_TEX"
sqlcmd -U texas -P texas -Q "drop procedure sp_export_no_TEX"
sqlcmd -U texas -P texas -Q "drop procedure sp_export_4_TEX"
sqlcmd -U texas -P texas -Q "drop procedure sp_import_no_TEX_Rel_4"
sqlcmd -U texas -P texas -Q "drop procedure sp_staging_no_TEX_Rel_4"
sqlcmd -U texas -P texas -Q "drop procedure sp_import_no_TEX_Rel_5"
sqlcmd -U texas -P texas -Q "drop procedure sp_staging_no_TEX_Rel_5"
sqlcmd -U texas -P texas -Q "drop procedure sp_import_4_TEX_Rel_5"
sqlcmd -U texas -P texas -Q "drop procedure sp_staging_4_TEX_Rel_5"
sqlcmd -U texas -P texas -Q "drop procedure sp_import_no_TEX_Rel_6"
sqlcmd -U texas -P texas -Q "drop procedure sp_staging_no_TEX_Rel_6"
sqlcmd -U texas -P texas -Q "drop procedure sp_import_4_TEX_Rel_6"
sqlcmd -U texas -P texas -Q "drop procedure sp_staging_4_TEX_Rel_6"
sqlcmd -U texas -P texas -d TEX -i sp_staging_old.sql
sqlcmd -U texas -P texas -d TEX -i sp_import.sql
sqlcmd -U texas -P texas -d TEX -i sp_import_from_old.sql
sqlcmd -U texas -P texas -d TEX -i sp_staging.sql
sqlcmd -U texas -P texas -d TEX -i sp_import_no_TEX.sql
sqlcmd -U texas -P texas -d TEX -i sp_import_no_TEX_Rel_4.sql
sqlcmd -U texas -P texas -d TEX -i sp_import_no_TEX_Rel_5.sql
sqlcmd -U texas -P texas -d TEX -i sp_import_no_TEX_Rel_6.sql
sqlcmd -U texas -P texas -d TEX -i sp_import_no_TEX_Rel_7.sql
sqlcmd -U texas -P texas -d TEX -i sp_import_4_TEX.sql
sqlcmd -U texas -P texas -d TEX -i sp_import_4_TEX_Rel_5.sql
sqlcmd -U texas -P texas -d TEX -i sp_import_4_TEX_Rel_6.sql
sqlcmd -U texas -P texas -d TEX -i sp_import_4_TEX_Rel_7.sql
sqlcmd -U texas -P texas -d TEX -i sp_staging_no_TEX_Rel_4.sql
sqlcmd -U texas -P texas -d TEX -i sp_staging_no_TEX_Rel_5.sql
sqlcmd -U texas -P texas -d TEX -i sp_staging_no_TEX_Rel_6.sql
sqlcmd -U texas -P texas -d TEX -i sp_staging_no_TEX_Rel_7.sql
sqlcmd -U texas -P texas -d TEX -i sp_staging_no_TEX.sql
sqlcmd -U texas -P texas -d TEX -i sp_staging_4_TEX.sql
sqlcmd -U texas -P texas -d TEX -i sp_staging_4_TEX_Rel_5.sql
错误:
"Windows cannot access the specified device, path, or file. You may not
have the appropriate permissions to access the item"
Also the following notification from antivirus program:
"A Process was blocked because malicious behaviour was detected"