crazy-eskelet
New Member
می خواستم بدونم چطوری می شه با mssql توی لوکال هاست برای ایجاد وب ویز فروم یه دیتابیس خالی ایجاد کرد. ورژن mssql من 2005 هست.
IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'test')
DROP DATABASE [test]
GO
/*
Create Db
*/
CREATE DATABASE [test] ON (NAME = N'test_Data', FILENAME = N'F:\SQLData\MSSQL\Data\test_Data.MDF' , SIZE = 3, FILEGROWTH = 10%) LOG ON (NAME = N'test_Log', FILENAME = N'F:\SQLData\MSSQL\Data\test_Log.LDF' , SIZE = 1, FILEGROWTH = 10%)
COLLATE SQL_Latin1_General_CP1_CI_AS
GO
/*
FOR Defaults
*/
exec sp_dboption N'test', N'autoclose', N'false'
GO
exec sp_dboption N'test', N'bulkcopy', N'false'
GO
exec sp_dboption N'test', N'trunc. log', N'false'
GO
exec sp_dboption N'test', N'torn page detection', N'true'
GO
exec sp_dboption N'test', N'read only', N'false'
GO
exec sp_dboption N'test', N'dbo use', N'false'
GO
exec sp_dboption N'test', N'single', N'false'
GO
exec sp_dboption N'test', N'autoshrink', N'false'
GO
exec sp_dboption N'test', N'ANSI null default', N'false'
GO
exec sp_dboption N'test', N'recursive triggers', N'false'
GO
exec sp_dboption N'test', N'ANSI nulls', N'false'
GO
exec sp_dboption N'test', N'concat null yields null', N'false'
GO
exec sp_dboption N'test', N'cursor close on commit', N'false'
GO
exec sp_dboption N'test', N'default to local cursor', N'false'
GO
exec sp_dboption N'test', N'quoted identifier', N'false'
GO
exec sp_dboption N'test', N'ANSI warnings', N'false'
GO
exec sp_dboption N'test', N'auto create statistics', N'true'
GO
exec sp_dboption N'test', N'auto update statistics', N'true'
GO
/*
Users Permissions
*/
if( ( (@@microsoftversion / power(2, 24) = 8) and (@@microsoftversion & 0xffff >= 724) ) or ( (@@microsoftversion / power(2, 24) = 7) and (@@microsoftversion & 0xffff >= 1082) ) )
exec sp_dboption N'test', N'db chaining', N'false'
GO
use [test]
GO
if not exists (select * from master.dbo.syslogins where loginname = N'#ServerName OR IP#\Administrator')
exec sp_grantlogin N'#ServerName OR IP#\Administrator'
exec sp_defaultdb N'#ServerName OR IP#\Administrator', N'master'
exec sp_defaultlanguage N'#ServerName OR IP#\Administrator', N'us_english'
GO
if not exists (select * from master.dbo.syslogins where loginname = N'#ServerName OR IP#\ASPNET')
exec sp_grantlogin N'#ServerName OR IP#\ASPNET'
exec sp_defaultdb N'#ServerName OR IP#\ASPNET', N'master'
exec sp_defaultlanguage N'#ServerName OR IP#\ASPNET', N'us_english'
GO
exec sp_addsrvrolemember N'#ServerName OR IP#\Administrator', sysadmin
GO