1. 在sql Server企業管理器中,創建一個網吧計費用的資料庫.
不是創建所能實現的
必須安裝一個計費的軟體
這樣它自動嵌入到
資料庫裡面了
2. SQL 的錯誤 求救~~~~~~~USE 教學成績管理資料庫 GO ALTER TABLE Sell DROP CONSTRAINT U_Email GO ALTER T
--只針對題目要求
IF EXISTS (SELECT * FROM sys.databases WHERE name = 'NetBar')
DROP DATABASE NetBar;
GO
-- Create the database.
CREATE DATABASE NetBar
ON PRIMARY
(name='netbar_data'氏蠢,
filename='c:\殲嘩陪netbar\netbar_data.mdf',
size=5mb,
maxsize=100mb,
filegrowth=5mb)
LOG ON
(name='netbar_log',
filename='c:\netbar\蘆和netbar_log.ldf',
size=5mb,
filegrowth=1mb
)
;
GO
use NetBar
alter database NetBar
set auto_shrink false
GO
CREATE LOGIN NetManager 'password@123'
GO
CREATE USER NetManager
GO
GRANT select on NetBar to NetManager
GO
3. Sql初學問題
只讀睜叢資料庫:EXEC sp_dboption 'NetBar', 'read only', true
自動收縮: EXEC sp_dboption 'NetBar' ,'autoshrink', true
設置登錄名麻煩一點,先添加登錄賬戶,再添加用戶,再為其賦於相應許可權
--添加帳戶
/*--添加SQLserver身份登錄帳戶--*/
EXEC sp_addlogin 'NetManager', '1234'脊攔,'NetBar' -- 帳戶:NetManager 密碼:1234 ,NetBar 為登錄後指定資料庫
--添櫻早胡加sqlserver身份登錄帳戶用戶
EXEC sp_grantdbaccess 'NetManager', 'aaa'
--賦予許可權
USE NetBar
GO
--對象許可權
GRANT select, insert, update ON table_Name TO aaa
--語句許可權
GRANT create table TO zhangsanDBUser
4. 視頻一卡通怎麼刪除NetBarBackup的文件~
手動備份一下資料庫,就可以全部刪除了。
如果你有經常手動備份數據搜友孫庫的習慣,可以在參數設置裡面把自動備份那個選項去掉。
如果保世鏈留這個選項,那最好改一下存放備告手份的目錄,不要放在C盤。
5. 網吧的一卡通怎麼破解
如何破解網攔扮吧視頻一卡通系統?
第一步,進入主機,c盤
program
files
然後找到一卡通的文件夾
netbar
進入後,找到他的資料庫
bardb.mdb
文件在用
第一步,進入主機,c盤
program
files
文件夾
然後找到一卡通的文件夾
netbar
進入後,找到他的數據晌衡臘庫
bardb.mdb
文件
在用資料庫助手,查看他的bardb.mdb
文件,然後
seat查詢
就出來所有上機的收費情況了。。然後找到你的機子號(ip),橫著看,最後面倒數第3個(prefare),就是錢了。哈哈,找到後就隨便你改了。還有一個辦法需要工具:
dameware
nt
utilities
漢化版
databrowser1.0
是明小子的。非常好用。
現在我們來開工。看****作。
首先打開
dameware
nt
utilities
漢化版
找到主機的名字。
現在的網吧安全意識很低的。。。
看進去了宴滑?
簡單
空密碼
唉~
現在我們來找一卡通的管理端文件netbar
這就是一卡通的文件。現在我們進入看看。
就是這個。。。我們來映射。。。做映射有很多種方法。先用最簡單的工具附帶。
看吧。右點就可以。
ok
這就是主機的c盤。
資料庫噢。。。
現在就要用到明小子的武器了
多出來的。。。
ok。。。seat
這就是一卡通卡號價錢的表格。
6. 在sql企業管理器中創建了資料庫NetBar用戶qq,但給qq許可權時,找不到資料庫NetBar。這是怎麼回事呢謝謝!
你已經在梁租亂資料庫中了,橡檔所以許可權指派時只顯示裡面的表
如果你在伺服器中的登錄名設置(就是你最外層的安全性里型衡面),
那裡面是針對資料庫的訪問許可權的
7. 以下數據和相應要求如何使用sql命令創建出來
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
USE [master];
GO
IF EXISTS (SELECT * FROM sys.databases WHERE name = 'School')
DROP DATABASE School;
GO
-- Create the School database.
CREATE DATABASE School;
GO
-- Specify a simple recovery model
-- to keep the log growth to a minimum.
ALTER DATABASE School
SET RECOVERY SIMPLE;
GO
USE School;
GO
-- Create the Department table.
IF NOT EXISTS (SELECT * FROM sys.objects
WHERE object_id = OBJECT_ID(N'[dbo].[Department]')
AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[Department](
[DepartmentID] [int] NOT NULL,
[Name] [nvarchar](50) NOT NULL,
[Budget] [money] NOT NULL,
[StartDate] [datetime] NOT NULL,
[Administrator] [int] NULL,
CONSTRAINT [PK_Department] PRIMARY KEY CLUSTERED
(
[DepartmentID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
-- Create the Person table.
IF NOT EXISTS (SELECT * FROM sys.objects
WHERE object_id = OBJECT_ID(N'[dbo].[Person]')
AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[Person](
[PersonID] [int] IDENTITY(1,1) NOT NULL,
[LastName] [nvarchar](50) NOT NULL,
[FirstName] [nvarchar](50) NOT NULL,
[HireDate] [datetime] NULL,
[EnrollmentDate] [datetime] NULL,
CONSTRAINT [PK_School.Student] PRIMARY KEY CLUSTERED
(
[PersonID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
-- Create the OnsiteCourse table.
IF NOT EXISTS (SELECT * FROM sys.objects
WHERE object_id = OBJECT_ID(N'[dbo].[OnsiteCourse]')
AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[OnsiteCourse](
[CourseID] [int] NOT NULL,
[Location] [nvarchar](50) NOT NULL,
[Days] [nvarchar](50) NOT NULL,
[Time] [smalldatetime] NOT NULL,
CONSTRAINT [PK_OnsiteCourse] PRIMARY KEY CLUSTERED
(
[CourseID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
-- Create the OnlineCourse table.
IF NOT EXISTS (SELECT * FROM sys.objects
WHERE object_id = OBJECT_ID(N'[dbo].[OnlineCourse]')
AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[OnlineCourse](
[CourseID] [int] NOT NULL,
[URL] [nvarchar](100) NOT NULL,
CONSTRAINT [PK_OnlineCourse] PRIMARY KEY CLUSTERED
(
[CourseID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
--Create the CourseGrade table.
IF NOT EXISTS (SELECT * FROM sys.objects
WHERE object_id = OBJECT_ID(N'[dbo].[CourseGrade]')
AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[CourseGrade](
[EnrollmentID] [int] IDENTITY(1,1) NOT NULL,
[CourseID] [int] NOT NULL,
[StudentID] [int] NOT NULL,
[Grade] [decimal](3, 2) NULL,
CONSTRAINT [PK_CourseGrade] PRIMARY KEY CLUSTERED
(
[EnrollmentID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
-- Create the CourseInstructor table.
IF NOT EXISTS (SELECT * FROM sys.objects
WHERE object_id = OBJECT_ID(N'[dbo].[CourseInstructor]')
AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[CourseInstructor](
[CourseID] [int] NOT NULL,
[PersonID] [int] NOT NULL,
CONSTRAINT [PK_CourseInstructor] PRIMARY KEY CLUSTERED
(
[CourseID] ASC,
[PersonID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
-- Create the Course table.
IF NOT EXISTS (SELECT * FROM sys.objects
WHERE object_id = OBJECT_ID(N'[dbo].[Course]')
AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[Course](
[CourseID] [int] NOT NULL,
[Title] [nvarchar](100) NOT NULL,
[Credits] [int] NOT NULL,
[DepartmentID] [int] NOT NULL,
CONSTRAINT [PK_School.Course] PRIMARY KEY CLUSTERED
(
[CourseID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
-- Create the OfficeAssignment table.
IF NOT EXISTS (SELECT * FROM sys.objects
WHERE object_id = OBJECT_ID(N'[dbo].[OfficeAssignment]')
AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[OfficeAssignment](
[InstructorID] [int] NOT NULL,
[Location] [nvarchar](50) NOT NULL,
[Timestamp] [timestamp] NOT NULL,
CONSTRAINT [PK_OfficeAssignment] PRIMARY KEY CLUSTERED
(
[InstructorID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
-- Define the relationship between OnsiteCourse and Course.
IF NOT EXISTS (SELECT * FROM sys.foreign_keys
WHERE object_id = OBJECT_ID(N'[dbo].[FK_OnsiteCourse_Course]')
AND parent_object_id = OBJECT_ID(N'[dbo].[OnsiteCourse]'))
ALTER TABLE [dbo].[OnsiteCourse] WITH CHECK ADD
CONSTRAINT [FK_OnsiteCourse_Course] FOREIGN KEY([CourseID])
REFERENCES [dbo].[Course] ([CourseID])
GO
ALTER TABLE [dbo].[OnsiteCourse] CHECK
CONSTRAINT [FK_OnsiteCourse_Course]
GO
-- Define the relationship between OnlineCourse and Course.
IF NOT EXISTS (SELECT * FROM sys.foreign_keys
WHERE object_id = OBJECT_ID(N'[dbo].[FK_OnlineCourse_Course]')
AND parent_object_id = OBJECT_ID(N'[dbo].[OnlineCourse]'))
ALTER TABLE [dbo].[OnlineCourse] WITH CHECK ADD
CONSTRAINT [FK_OnlineCourse_Course] FOREIGN KEY([CourseID])
REFERENCES [dbo].[Course] ([CourseID])
GO
ALTER TABLE [dbo].[OnlineCourse] CHECK
CONSTRAINT [FK_OnlineCourse_Course]
GO
-- Define the relationship between CourseGrade and Course.
IF NOT EXISTS (SELECT * FROM sys.foreign_keys
WHERE object_id = OBJECT_ID(N'[dbo].[FK_CourseGrade_Course]')
AND parent_object_id = OBJECT_ID(N'[dbo].[CourseGrade]'))
ALTER TABLE [dbo].[CourseGrade] WITH CHECK ADD
CONSTRAINT [FK_CourseGrade_Course] FOREIGN KEY([CourseID])
REFERENCES [dbo].[Course] ([CourseID])
GO
ALTER TABLE [dbo].[CourseGrade] CHECK
CONSTRAINT [FK_CourseGrade_Course]
GO
--Define the relationship between CourseGrade and Student.
IF NOT EXISTS (SELECT * FROM sys.foreign_keys
WHERE object_id = OBJECT_ID(N'[dbo].[FK_CourseGrade_Student]')
AND parent_object_id = OBJECT_ID(N'[dbo].[CourseGrade]'))
ALTER TABLE [dbo].[CourseGrade] WITH CHECK ADD
CONSTRAINT [FK_CourseGrade_Student] FOREIGN KEY([StudentID])
REFERENCES [dbo].[Person] ([PersonID])
GO
ALTER TABLE [dbo].[CourseGrade] CHECK
CONSTRAINT [FK_CourseGrade_Student]
GO
-- Define the relationship between CourseInstructor and Course.
IF NOT EXISTS (SELECT * FROM sys.foreign_keys
WHERE object_id = OBJECT_ID(N'[dbo].[FK_CourseInstructor_Course]')
AND parent_object_id = OBJECT_ID(N'[dbo].[CourseInstructor]'))
ALTER TABLE [dbo].[CourseInstructor] WITH CHECK ADD
CONSTRAINT [FK_CourseInstructor_Course] FOREIGN KEY([CourseID])
REFERENCES [dbo].[Course] ([CourseID])
GO
ALTER TABLE [dbo].[CourseInstructor] CHECK
CONSTRAINT [FK_CourseInstructor_Course]
GO
-- Define the relationship between CourseInstructor and Person.
IF NOT EXISTS (SELECT * FROM sys.foreign_keys
WHERE object_id = OBJECT_ID(N'[dbo].[FK_CourseInstructor_Person]')
AND parent_object_id = OBJECT_ID(N'[dbo].[CourseInstructor]'))
ALTER TABLE [dbo].[CourseInstructor] WITH CHECK ADD
CONSTRAINT [FK_CourseInstructor_Person] FOREIGN KEY([PersonID])
REFERENCES [dbo].[Person] ([PersonID])
GO
ALTER TABLE [dbo].[CourseInstructor] CHECK
CONSTRAINT [FK_CourseInstructor_Person]
GO
-- Define the relationship between Course and Department.
IF NOT EXISTS (SELECT * FROM sys.foreign_keys
WHERE object_id = OBJECT_ID(N'[dbo].[FK_Course_Department]')
AND parent_object_id = OBJECT_ID(N'[dbo].[Course]'))
ALTER TABLE [dbo].[Course] WITH CHECK ADD
CONSTRAINT [FK_Course_Department] FOREIGN KEY([DepartmentID])
REFERENCES [dbo].[Department] ([DepartmentID])
GO
ALTER TABLE [dbo].[Course] CHECK CONSTRAINT [FK_Course_Department]
GO
--Define the relationship between OfficeAssignment and Person.
IF NOT EXISTS (SELECT * FROM sys.foreign_keys
WHERE object_id = OBJECT_ID(N'[dbo].[FK_OfficeAssignment_Person]')
AND parent_object_id = OBJECT_ID(N'[dbo].[OfficeAssignment]'))
ALTER TABLE [dbo].[OfficeAssignment] WITH CHECK ADD
CONSTRAINT [FK_OfficeAssignment_Person] FOREIGN KEY([InstructorID])
REFERENCES [dbo].[Person] ([PersonID])
GO
ALTER TABLE [dbo].[OfficeAssignment] CHECK
CONSTRAINT [FK_OfficeAssignment_Person]
GO
-- Create InsertOfficeAssignment stored procere.
IF NOT EXISTS (SELECT * FROM sys.objects
WHERE object_id = OBJECT_ID(N'[dbo].[InsertOfficeAssignment]')
AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'
CREATE PROCEDURE [dbo].[InsertOfficeAssignment]
@InstructorID int,
@Location nvarchar(50)
AS
INSERT INTO dbo.OfficeAssignment (InstructorID, Location)
VALUES (@InstructorID, @Location);
IF @@ROWCOUNT > 0
BEGIN
SELECT [Timestamp] FROM OfficeAssignment
WHERE InstructorID=@InstructorID;
END
'
END
GO
--Create the UpdateOfficeAssignment stored procere.
IF NOT EXISTS (SELECT * FROM sys.objects
WHERE object_id = OBJECT_ID(N'[dbo].[UpdateOfficeAssignment]')
AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'
CREATE PROCEDURE [dbo].[UpdateOfficeAssignment]
@InstructorID int,
@Location nvarchar(50),
@OrigTimestamp timestamp
AS
UPDATE OfficeAssignment SET Location=@Location
WHERE InstructorID=@InstructorID AND [Timestamp]=@OrigTimestamp;
IF @@ROWCOUNT > 0
BEGIN
SELECT [Timestamp] FROM OfficeAssignment
WHERE InstructorID=@InstructorID;
END
'
END
GO
-- Create the DeleteOfficeAssignment stored procere.
IF NOT EXISTS (SELECT * FROM sys.objects
WHERE object_id = OBJECT_ID(N'[dbo].[DeleteOfficeAssignment]')
AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'
CREATE PROCEDURE [dbo].[DeleteOfficeAssignment]
@InstructorID int
AS
DELETE FROM OfficeAssignment
WHERE InstructorID=@InstructorID;
'
END
GO
-- Create the DeletePerson stored procere.
IF NOT EXISTS (SELECT * FROM sys.objects
WHERE object_id = OBJECT_ID(N'[dbo].[DeletePerson]')
AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'
CREATE PROCEDURE [dbo].[DeletePerson]
@PersonID int
AS
DELETE FROM Person WHERE PersonID = @PersonID;
'
END
GO
-- Create the UpdatePerson stored procere.
IF NOT EXISTS (SELECT * FROM sys.objects
WHERE object_id = OBJECT_ID(N'[dbo].[UpdatePerson]')
AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'
CREATE PROCEDURE [dbo].[UpdatePerson]
@PersonID int,
@LastName nvarchar(50),
@FirstName nvarchar(50),
@HireDate datetime,
@EnrollmentDate datetime
AS
UPDATE Person SET LastName=@LastName,
FirstName=@FirstName,
HireDate=@HireDate,
EnrollmentDate=@EnrollmentDate
WHERE PersonID=@PersonID;
'
END
GO
-- Create the InsertPerson stored procere.
IF NOT EXISTS (SELECT * FROM sys.objects
WHERE object_id = OBJECT_ID(N'[dbo].[InsertPerson]')
AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'
CREATE PROCEDURE [dbo].[InsertPerson]
@LastName nvarchar(50),
@FirstName nvarchar(50),
@HireDate datetime,
@EnrollmentDate datetime
AS
INSERT INTO dbo.Person (LastName,
FirstName,
HireDate,
EnrollmentDate)
VALUES (@LastName,
@FirstName,
@HireDate,
@EnrollmentDate);
SELECT SCOPE_IDENTITY() as NewPersonID;
'
END
GO
-- Create GetStudentGrades stored procere.
IF NOT EXISTS (SELECT * FROM sys.objects
WHERE object_id = OBJECT_ID(N'[dbo].[GetStudentGrades]')
AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'
CREATE PROCEDURE [dbo].[GetStudentGrades]
@StudentID int
AS
SELECT EnrollmentID, Grade FROM dbo.CourseGrade
WHERE StudentID = @StudentID
'
END
GO
-- Insert data into the Person table.
USE School
GO
SET IDENTITY_INSERT dbo.Person ON
大同小異,自己改一下
8. 求2015《SQLSERVER資料庫基礎》機試,的答案有嗎
你好!
由於回答的字數限制,給你回答一下第一問題:
usemaster
createdatabaseNetBarDB--創建的資料庫名稱
onprimary--主文件組,primary可以省略
(
name=N'NetBarDB',--資料庫文件的邏輯名
filename=N'D:NetBarDB.mdf',--全路徑加上後綴
size=10mb,
maxsize=100mb,
filegrowth=1mb
)
logon--邏輯文件
(
name=N'TwoDataBase_log',--邏輯文件名,不能和前面的文件同名,一般都是下劃線後加一個log
filename=N'D:NetBarDB.ldf',
size=100mb,
maxsize=1gb,
filegrowth=10mb
);
go
有什麼問題,請您新開提問!
望採納!
9. 在SQL Server企業管理器中,創建一個網吧計費用的資料庫.
不是創建所能實現的
必須安裝一個計費的軟體 這樣它自動嵌入到 資料庫裡面了
10. r在sql企業管理器中創建了資料庫NetBar用戶qq,但給qq許可權時,找不到資料庫NetBar。這是怎麼回事呢謝謝!
你已兄山經在netbar庫下面分配了,當然看不到了,這里設置的是給表的許可權,不升凱是庫的許可權如果想看吵塵喚到,去資料庫--安全性下面設置,就可以了。