请问各位大哥,如何做到:执行一个exe文件,在本机的sql数据库上创建一个数据库,字段、索引、等关系都不能丢失!
---------------------------------------------------------------
不知你是用什么开发工具,我用DELPHI,首先将SQL语句放在一EDIT中,然后将其TEXT值赋给控件QUERY的SQL,执行即可.
---------------------------------------------------------------
use sql in your program
---------------------------------------------------------------
or:
use sqldmo:(from help)
To create a SQL Server database
Create a Database object.
Set the Name property of the Database object.
Create a DBFile object.
Set the Name property of the DBFile object.
Set the PhysicalName property of the DBFile object.
Set DBFile object properties optional for new database files, such as Size.
Add the DBFile object to the new Database object FileGroup object named PRIMARY.
Add the Database object to the Databases collection of a connected SQLServer object.
To specify a log file
Create a LogFile object.
Set the Name property.
Set the PhysicalName property.
Set the LogFile Size property.
Add the LogFile object to the LogFiles collection of the TransactionLog object of the new Database object.