Dim cn As Connection
Dim str As String
str = "CREATE DATABASE Sales " & _
"ON (NAME = Sales_dat," & _
"FILENAME = 'D:\saledatmdf'," & _
"SIZE = 1MB,MAXSIZE = 5MB,FILEGROWTH = 10% )" & _
"LOG ON ( NAME = 'Sales_log'," & _
"FILENAME = 'D:\salelogldf'," & _
"SIZE = 1MB,MAXSIZE = 5MB,FILEGROWTH = 5MB )"
Set cn = New Connection
With cn
ConnectionString = "Provider=SQLOLEDB1;Data Source=pmserver;User ID=sa;Password=sa"
Open
Execute str
End With
Set cn = Nothing
---------------------------------------------------------------
Dim cn As Connection
Dim str As String
str = "CREATE DATABASE Sales " & _
"ON (NAME = Sales_dat," & _
"FILENAME = 'D:\saledatmdf'," & _
"SIZE = 1MB,MAXSIZE = 5MB,FILEGROWTH = 10% )" & _
"LOG ON ( NAME = 'Sales_log'," & _
"FILENAME = 'D:\salelogldf'," & _
"SIZE = 1MB,MAXSIZE = 5MB,FILEGROWTH = 5MB )"
Set cn = New Connection
With cn
ConnectionString = "Provider=SQLOLEDB1;Data Source=pmserver;User ID=sa;Password=sa"
Open
Execute str
End With
Set cn = Nothing
---------------------------------------------------------------
CREATE DATABASE database_name On Primary (Name=databasename,Filename=xxxxmdf,Size=15MB,Filegrowth=10%) Log On (Name=databaselog,Filename=xxxxldf,Size=3MB,Maxsize=10MB,FileGrowth=1MB)
SQL Server 2008使用的T-SQL是标准SQL(结构化查询语言)的增强版本,使用它提供的CREATE DATABASE语句同样可以完成新建数据库 *** 作。
>
以上就是关于如何创建一个SQL数据库全部的内容,包括:如何创建一个SQL数据库、如何使用sql表结构创建数据库、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)