PDA

View Full Version : ساخت DB با OLE



Mahdi_20
سه شنبه 12 مهر 1384, 15:48 عصر
با سلام
چطوری میتونم بانک اطلاعاتی با OLE بسازم..
برای این کار مثل SQL نرم افزار نصب کنیم؟!!
خواهشا در این مورد یکم برام بتوضیحین..
با تشکر.

Mahdi_20
چهارشنبه 13 مهر 1384, 08:05 صبح
دوستان اگه میشه یه لطفی به بنده بکنن.
ممنون...

Mahdi_20
پنج شنبه 14 مهر 1384, 10:01 صبح
یعنی هیچ کی با OLE کار نکرده.!!؟

Farhad.B.S
پنج شنبه 14 مهر 1384, 17:24 عصر
معمولا دیتابیس سرور های معروف اینجور قابیلت ها رو از طریق COM یا به صورت های دیگه در اختیار میزارن.
SQLServre از طریق SQL DMO این قابلیت ها رو به اشتراک میزاره ، برای اطلاعات بیشتر راجع به SQL DMO جستجو کن.

Mahdi_20
شنبه 16 مهر 1384, 16:26 عصر
لطفا بیشتر توضیح بدین..

Hamedm
شنبه 16 مهر 1384, 17:21 عصر
سلام

امیدوارم منظورتونو درست متوجه شده باشم.

در خود زبان برنامه نویسی چرا همین کارو انجام نمیدید؟

این هم Syntax دستور این کار:

CREATE DATABASE database_name
[ ON
[ < filespec > [ ,...n ] ]
[ , < filegroup > [ ,...n ] ]
]
[ LOG ON { < filespec > [ ,...n ] } ]
[ COLLATE collation_name ]
[ FOR LOAD | FOR ATTACH ]

< filespec > ::=

[ PRIMARY ]
( [ NAME = logical_file_name , ]
FILENAME = 'os_file_name'
[ , SIZE = size ]
[ , MAXSIZE = { max_size | UNLIMITED } ]
[ , FILEGROWTH = growth_increment ] ) [ ,...n ]

< filegroup > ::=

FILEGROUP filegroup_name < filespec > [ ,...n ]

Arguments

database_name

Is the name of the new database. Database names must be unique within a server and conform to the rules for identifiers. database_name can be a maximum of 128 characters, unless no logical name is specified for the log. If no logical log file name is specified, Microsoft® SQL Server™ generates a logical name by appending a suffix to database_name. This limits database_name to 123 characters so that the generated logical log file name is less than 128 characters.

ON

Specifies that the disk files used to store the data portions of the database (data files) are defined explicitly. The keyword is followed by a comma-separated list of <filespec> items defining the data files for the primary filegroup. The list of files in the primary filegroup can be followed by an optional, comma-separated list of <filegroup> items defining user filegroups and their files.

n

Is a placeholder indicating that multiple files can be specified for the new database.

LOG ON

Specifies that the disk files used to store the database log (log files) are explicitly defined. The keyword is followed by a comma-separated list of <filespec> items defining the log files. If LOG ON is not specified, a single log file is automatically created with a system-generated name and a size that is 25 percent of the sum of the sizes of all the data files for the database.

FOR LOAD

This clause is supported for compatibility with earlier versions of Microsoft SQL Server. The database is created with the dbo use only database option turned on, and the status is set to loading. This is not required in SQL Server version 7.0 because the RESTORE statement can recreate a database as part of the restore operation.

FOR ATTACH

Specifies that a database is attached from an existing set of operating system files. There must be a <filespec> entry specifying the first primary file. The only other <filespec> entries needed are those for any files that have a different path from when the database was first created or last attached. A <filespec> entry must be specified for these files. The database attached must have been created using the same code page and sort order as SQL Server. Use the sp_attach_db system stored procedure instead of using CREATE DATABASE FOR ATTACH directly. Use CREATE DATABASE FOR ATTACH only when you must specify more than 16 <filespec> items.

If you attach a database to a server other than the server from which the database was detached, and the detached database was enabled for replication, you should run sp_removedbreplication to remove replication from the database.

collation_name

Specifies the default collation for the database. Collation name can be either a Windows collation name or a SQL collation name. If not specified, the database is assigned the default collation of the SQL Server instance.

For more information about the Windows and SQL collation names, see COLLATE (ts_ca-co_5z55.htm).

PRIMARY

Specifies that the associated <filespec> list defines the primary file. The primary filegroup contains all of the database system tables. It also contains all objects not assigned to user filegroups. The first <filespec> entry in the primary filegroup becomes the primary file, which is the file containing the logical start of the database and its system tables. A database can have only one primary file. If PRIMARY is not specified, the first file listed in the CREATE DATABASE statement becomes the primary file.

NAME

Specifies the logical name for the file defined by the <filespec>. The NAME parameter is not required when FOR ATTACH is specified.

logical_file_name

Is the name used to reference the file in any Transact-SQL statements executed after the database is created. logical_file_name must be unique in the database and conform to the rules for identifiers. The name can be a character or Unicode constant, or a regular or delimited identifier.

FILENAME

Specifies the operating-system file name for the file defined by the <filespec>.

'os_file_name'

Is the path and file name used by the operating system when it creates the physical file defined by the <filespec>. The path in os_file_name must specify a directory on an instance of SQL Server. os_file_name cannot specify a directory in a compressed file system.

If the file is created on a raw partition, os_file_name must specify only the drive letter of an existing raw partition. Only one file can be created on each raw partition. Files on raw partitions do not autogrow; therefore, the MAXSIZE and FILEGROWTH parameters are not needed when os_file_name specifies a raw partition.

SIZE

Specifies the size of the file defined in the <filespec>. When a SIZE parameter is not supplied in the <filespec> for a primary file, SQL Server uses the size of the primary file in the modeldatabase. When a SIZE parameter is not specified in the <filespec> for a secondary or log file, SQL Server makes the file 1 MB.

size

Is the initial size of the file defined in the <filespec>. The kilobyte (KB), megabyte (MB), gigabyte (GB), or terabyte (TB) suffixes can be used. The default is MB. Specify a whole number; do not include a decimal. The minimum value for size is 512 KB. If size is not specified, the default is 1 MB. The size specified for the primary file must be at least as large as the primary file of the model database.

MAXSIZE

Specifies the maximum size to which the file defined in the <filespec> can grow.

max_size

Is the maximum size to which the file defined in the <filespec> can grow. The kilobyte (KB), megabyte (MB), gigabyte (GB), or terabyte (TB) suffixes can be used. The default is MB. Specify a whole number; do not include a decimal. If max_size is not specified, the file grows until the disk is full.



mk:@MSITStore:C:%5CProgram%20Files%5CMicrosoft%20S QL%20Server%5C80%5CTools%5CBooks%5Ctsqlref.chm::/Basics/note.gif Note The Microsoft Windows NT® S/B system log warns the SQL Server system administrator if a disk is almost full.

UNLIMITED

Specifies that the file defined in the <filespec> grows until the disk is full.

FILEGROWTH

Specifies the growth increment of the file defined in the <filespec>. The FILEGROWTH setting for a file cannot exceed the MAXSIZE setting.

growth_increment

Is the amount of space added to the file each time new space is needed. Specify a whole number; do not include a decimal. A value of 0 indicates no growth. The value can be specified in MB, KB, GB, TB, or percent (%). If a number is specified without an MB, KB, or % suffix, the default is MB. When % is specified, the growth increment size is the specified percentage of the size of the file at the time the increment occurs. If FILEGROWTH is not specified, the default value is 10 percent and the minimum value is 64 KB. The size specified is rounded to the nearest 64 KB.



در پناه حق موفق باشید و پرتوان

Farhad.B.S
یک شنبه 17 مهر 1384, 00:58 صبح
مثال هایی راجع به استفاده از DMO :
http://www.windowsitpro.com/SQLServer/Article/ArticleID/20350/20350.html
http://www.windowsitpro.com/Windows/Article/ArticleID/564/564.html
http://www.sqlteam.com/item.asp?ItemID=9093