问题描述
我创建了一个安装程序来自动在服务器上生成数据库和表.此应用程序仅适用于sql server.
我必须针对各种数据库(如oracle,db2等)归纳相同的应用程序.
我已经用c#编写了应用程序.
为此,我创建了一个文本文件,其中包含用于生成db及其表的脚本.我的问题是:从该文件中一一执行sql语句
以下是文件的内容
/***************************************************** ****************
创建 数据库 [信息] 收集 SQL_Latin1_General_CP1_CI_AS 转到 使用 [信息] 转到 创建 表 [dbo].[员工]( [名称] [字符]( 30 )>收集 SQL_Latin1_General_CP1_CI_AS 否 NULL , [Rsvp] [ int ] NULL , [请求] [ nvarchar ]( 4000 )>收集 SQL_Latin1_General_CP1_CI_AS NULL )打开 [ PRIMARY ]; 更改 表 [dbo].[员工] >还有 否 ADD CONSTRAINT [PK_Employees] PRIMARY KEY 集群 ( [姓名] )打开 [ PRIMARY ];
****************************************************** *****************/
请同样帮我.
问候,
Amol
Hi,
I have created a installer to generate database and tables on server automatically.This application works fine only with sql server.
I have to generalize the same application for various dbs like oracle,db2,etc.
I have written the application in c#.
for this i have create a text file which contains script for genrating db and its tables.My problem is:executing sql statement one by one from this file
following is the content of the file
/*****************************************************************
CREATE DATABASE [Info] COLLATE SQL_Latin1_General_CP1_CI_AS GO USE [Info] GO CREATE TABLE [dbo].[Employees] ( [Name] [char] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [Rsvp] [int] NULL , [Requests] [nvarchar] (4000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ) ON [PRIMARY]; ALTER TABLE [dbo].[Employees] WITH NOCHECK ADD CONSTRAINT [PK_Employees] PRIMARY KEY CLUSTERED ( [Name] ) ON [PRIMARY];
*******************************************************************/
please help me for the same.
Regards,
Amol
这篇关于帮助生成;使sql db genrater脚本有效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!