Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 I feel stupid - some T-SQL help please

Author  Topic 

Mike2008
Starting Member

11 Posts

Posted - 2008-10-19 : 16:35:16
I probably miss something .. maybe you guys can help me.

I am trying the following using purely TSQL in one query:

1. Create a database called "datatest"
2. Create a table in that database also called "datatest"
3. Create one column - column name : "datatest", Datatype "Varchar (50)
4. Add a string in that table, for example "this is a test"
5. Create a user called "datatest" with SQL authentication
6. Give that user a password called "p4$$w0rd" (no enforce password policy)
7. Default database for this user is "datatest"
8. Map the user "datatest" to this database and assign the role db_owner and public
9. Create a "Full" backup on the C-Drive
10.Create a "Transaction Log" backup on the C-Drive

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2008-10-19 : 16:40:14
Have you considering asking your teacher for help? Or even refering to your textboooks or using Google to do some searching in an attempt to find the answer on your own?

We don't answer homework questions for people here. If you show us what you have tried, we can help you out and perhaps guide you in the right direction, but you won't learn anything if we just give you the answers.

- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page

Mike2008
Starting Member

11 Posts

Posted - 2008-10-19 : 17:08:46
No teacher .. he is probably dead already ( I am in my late 30s) :P

I am working in a hosting company and our DBA is sick and we required a test page for a customer and I was the only one awake and on MSN :)

But yea .. tried it myself for ages already .. but sorted already

use MASTER;
create database datatest;
Go

use datatest;
CREATE TABLE datatest
(
datatest varchar(50),
);
Go

INSERT INTO dbo.datatest VALUES ('MSSQL / IIS working');
Go

CREATE LOGIN datatest WITH PASSWORD = 'pentium97' ,
DEFAULT_DATABASE = datatest,
CHECK_EXPIRATION = OFF,
CHECK_POLICY = OFF
go

CREATE USER [datatest] FOR LOGIN [datatest]
GO

USE [datatest]
GO

EXEC sp_addrolemember N'db_owner', N'datatest'
GO



Only backup to go ...

Go to Top of Page

Mike2008
Starting Member

11 Posts

Posted - 2008-10-19 : 17:50:52
Right, thats sorted too.

Go to Top of Page
   

- Advertisement -