Creating New Tables For New Users
Oct 16, 2007
hi all,
How can i create a new data table automatically for new users signing into the website.......what i mean here is that i have a predefined database table and i want that users signing in can have that table for them unique , so that they can fill data for themselves and that data will be visible to all just like forums
View 1 Replies
ADVERTISEMENT
May 1, 2007
Hi All
i WANT to create users for database or sever in SQL SERVER 2005
HOW CAN I GO
Thanks in Advance
Malathi Rao
View 6 Replies
View Related
Aug 17, 2004
I am trying to create a new user for a SQL Server database and use the credentials in an
ASP.NET app.
Problem is dbo permissions are not being applied to the database objects when I set up a
new user (Logins -> New Logins) with SQL Server Authentication, set the default database to
the database I want.
I then get an error message saying that the user has not been granted access to their default
database : DBNAME and therefore will not be able to gain access to their default database.
I'm not sure why this is as I am logged in as sa.
Anyway, when I ignore the error and set-up this new user through the Users section of the
database none of the dbo permissions carry over.
Can anyone help?
Cheers.
View 1 Replies
View Related
Jan 13, 2000
I'm not sure why this is not working, a similar process worked in 6.5 I migrated yesterday.
I restore a database backup from another server. I delete all the users in that database under both Users and Roles, as well as under Security/Logins. Then under Security/Logins I recreate three login and try to reassign them to the appropriate Role. I get an error message: "User or Role already exists in current database". I already deleted that user, the only place he exists is in Public role, which is ok. I don't understand I must be doing something wrong?
Thanks,
Paul
View 1 Replies
View Related
Apr 12, 2007
Ok I just installed SQl 2005 for the very first time. I used a service account(domain admin)and Windows NT authentication to install SQL.
Now I am setting up Mcafee EPO on a different server. This application can either install MSDE or use a sql database. I want to use my new SQL server.
What are the best practices to :
a)create database on SQL
b)create a user
c)what permissions to give this user
For example during installation of Mcafee EPO it is asking me name of the remote SQL server, authentication method(Windows or SQL)and the user account.
I am starting to read about SQL but need some quick answers. I need to do the same thing for my SMS 2003 installation. Thanks.
View 4 Replies
View Related
Jul 20, 2005
I have MSDE installed on my sistem, and I need to add a new user.How do I go about doing this?
View 2 Replies
View Related
Jun 13, 2006
Hi,
wanted to add a login in via c# to sql server express.
Is this possible?
I treid this:
String connString = "data source=xtrlt027;Initial catalog=master;Integrated Security=true;"; SqlConnection conn= new SqlConnection();; conn.ConnectionString = connString; try { System.Console.WriteLine("Opening Connection..."); conn.Open(); System.Console.WriteLine("Connection opened!!!"); SqlCommand cmd = new SqlCommand("create login tommtk with Password='tomm2tomm'; use master; create user tommtk;", conn); cmd.ExecuteNonQuery(); System.Console.WriteLine("Login created!!!"); } catch (Exception deleteEx) { System.Console.WriteLine("SqlException Handle :{0}", deleteEx.ToString()); } finally { conn.Close(); System.Console.WriteLine("Connection closed!!!"); }
But i get an exception, that there is an error near the keyword login and the keyword user.So wahts wrongcan anybody help me?Greetz
View 9 Replies
View Related
Feb 4, 2008
Hi, this is a bit of background to what I'm trying to achive:
I have an application that creates a new database in MS 2000. The application will then create a login, with then create a user and add the login to the user, it will then add that user to the folling roles; db_owner, db_datareader, db_datawriter.
A SQL script is then run to add tables, view and stored procedures to the new database.
Most of this works however I'm having a few problems with loging in as the new user. Aslo how do I ensure that if new objects (tables, stored procs etc) are added the new user will have full permissions on them?
This is the code I have so far...I'm going round in circles with it and was hoping that someone with fresh eyes might be able to see where I'm going wrong:
Many thanks
1 protected string CreateUser(string strDatabaseName)
2 {
3 //database hase alreday been created
4 SQLDMO.SQLServer gSQLServerDMO = new SQLDMO.SQLServer();
5
6 string serverName = ConfigurationManager.AppSettings["DbsServerName"];
7 gSQLServerDMO.Connect(serverName,
8 ConfigurationManager.AppSettings["DbsUserName"],
9 ConfigurationManager.AppSettings["DbsUserPwd"]);
10 //get the database object
11 SQLDMO.Database dbs = (SQLDMO.Database)gSQLServerDMO.Databases.Item(strDatabaseName, "");
12
13 #region create a login object and populate it
14 SQLDMO.Login login = new SQLDMO.Login();
15 string loginName = strDatabaseName + "_WebLogin";
16 login.Name = loginName;
17 string password = "password";
18
19 login.SetPassword("", password);
20 login.Database = strDatabaseName;
21
22 //check if it exists
23 bool found = false;
24 foreach (SQLDMO.Login ologin in gSQLServerDMO.Logins)
25 {
26 if (ologin.Name == loginName)
27 {
28 found = true;
29 break;
30 }
31 }
32 if (!found)
33 gSQLServerDMO.Logins.Add(login);
34 #endregion
35
36 #region create the user
37 SQLDMO.User user = new SQLDMO.User();
38 //assign the login
39 string userName = strDatabaseName+ "_WebUser";
40 user.Name = userName;
41 user.Login = loginName;
42 //dbs.Users.Add(user);
43
44 found = false;
45 foreach (SQLDMO.User oUser in dbs.Users)
46 {
47 if (oUser.Name == loginName)
48 {
49 found = true;
50 break;
51 }
52 }
53 if (!found)//add the user to the dbs
54 {
55 dbs.Users.Add(user);
56
57 //add user to role
58 //db_owner
59 //SQLDMO.DatabaseRole oRole = new SQLDMO.DatabaseRole();
60 //oRole =
61 //oRole.AddMember(loginName);
62 dbs.DatabaseRoles.Item("db_owner").AddMember(userName);
63 dbs.DatabaseRoles.Item("db_datareader").AddMember(userName);
64 dbs.DatabaseRoles.Item("db_datawriter").AddMember(userName);
65 }
66 #endregion
67
68 string connString = "server=" + serverName + ";database=" + strDatabaseName + ";uid=" + userName
69 + ";pwd=" + password + ";";
View 1 Replies
View Related
Aug 11, 2013
I would like to create a database & save to that data base the ratings of articles that are given by the users.
(I want to create a recommendation system.)
I am using joomla! How do I do this ?
View 1 Replies
View Related
Sep 20, 2007
Hi Everybody,
I am trying to setup a stored procedure that runs through a Reminders table and sends an email to users based on DateSent field being smaller than todays date. I have already setup the stored procedure to send the email, just having trouble looping through the recordset.
Code Snippet
CREATE PROCEDURE [dbo].[hrDB_SendEmail]
AS
BEGIN
DECLARE @FirstName nvarchar(256),
@LastName nvarchar(256),
@To nvarchar(256),
@ToMgr nvarchar(256),
@Subject nvarchar(256),
@Msg nvarchar(256),
@DateToSend datetime,
@Sent nvarchar(256),
@ReminderID int,
@RowCount int,
@Today datetime,
@Result nvarchar(256)
-- Get the reminders to send
SELECT
@ReminderID = r.intReminderID,
@DateToSend = r.datDateToSend,
@FirstName = e.txtFirstName,
@LastName = e.txtLastName,
@To = e.txtEmail,
@Subject = t.txtReminderSubject,
@Sent = r.txtSent
FROM
(auto_reminders r INNER JOIN employee e ON r.intEmployeeID = e.intEmployeeID) INNER JOIN ref_reminders t ON r.intReminderType = t.intReminderTempID
WHERE
(((r.datDateToSend)<20/12/09) AND
((r.txtSent)='False'))
-- Send the Emails
WHILE(LEN(@To) > 0)
BEGIN
EXEC @Result = sp_send_cdosysmail @To, @ToMgr, @Subject, @Msg
END
-- Mark the records as sent
IF @Result = 'sp_OAGetErrorInfo'
BEGIN
SELECT @Sent = 'Error'
END
ELSE
BEGIN
SELECT @Sent = 'True'
END
UPDATE auto_reminders
SET
auto_reminders.txtSent = @Sent, auto_reminders.datDateSent = @Today
WHERE
intReminderID = @ReminderID
END
GO
From the code you can probably tell I am new to writing stored procedures, so I apologise for any obvious errors. My major problems are :-
how to loop through each record
how to get todays date
whether the struture of the procedure is correct
Also, if you think there is an easier way or a better method, please suggest it. I am open to any suggestions you may have,
Thanks in advance
Ben
View 1 Replies
View Related
Dec 21, 2005
Hello,In my web site I have 2 types of users: students and professors.All users need to login but the personal information for each user type has different fields.So I create 3 tables: professors, students and authentication,"professors" will have all the personal data from professors."students" will have all the personal data from students.authentication will have the username and password from all users.How can i link authentication table to both professors and students tables so when the user logins i get the data from that user, either a professor or student?And is the right way to do this?I am using SQL 2005 and Asp.Net 2.0Thanks,Miguel
View 1 Replies
View Related
Nov 30, 2004
I know this may sound stupid but I really can't figure out how to do it. I just keep going around in cricles.
I need to create six table under three different users. so I would have users1 owning tableA and tableB. Then I would have users2 owning another copy of tableA and tableB. same for users3.
But I just can't find a way of doing it, I am using enterprise manager. Please help, Ed
View 5 Replies
View Related
May 30, 2003
We have an OLTP application with multiple one to many tables relationships that are edited client side. For Example the primary table has descriptive components. One of the multiple table have things like parts and quantity ordered linked by a record number back to the primary table.
When our client transmits their transaction, they actally running a batch job which sends all the client side tables to the SQL Server and then we are trying to issue a stored procedure server side to push this data into our 'dbo' owned server side master tables.
Our problem is generating the fully qualified table name for the from clause.
We have tried declaring a variable but the stored procedure won't compile. Tried user, user_name().
Any solutions would be greatly appreciated.
View 3 Replies
View Related
Mar 7, 2008
How can I hide the system tables (sys and INFORMATION_SCHEMA) from users? I am not talking about Management Studio. We have users who access the database with ODBC and I do not want them to see all these system tables.
I have created a Hide_System_Tables role and added users to it. I have tried denying all the permissions to this role, but they still see it. Oddly enough, in the INFORMATION_SCHEMA permissions, it shows access from grantors of INFORMATION_SCHEMA and dbo. I cannot deny permission for the entries with dbo as grantor.
Does anyone have any suggestions on where I have to go to remove all the places that give users access to these tables?
Thanks,
Mike
View 6 Replies
View Related
Jan 28, 2008
Hi,
Can someone help me to hide all system views/tables from users?
I do not want the users to see all system tables/views, so they can have a clear view for only user tables in their schema.
Thx,
Vicki
View 20 Replies
View Related
Aug 9, 2007
Hi,How can i reset to zero, deleting all the users who are in the aspnet_* tables in my production 2003 server?Thanks
View 6 Replies
View Related
Nov 26, 2014
I am trying to clean up security. When I check tables in a specific database I see a list of users with select access. There are 1000+ tables in the database. I know I can do 'revoke select on table_name to user_name' ....
View 3 Replies
View Related
Oct 16, 2006
I need to set up 1 new user in SQL Server 2005 to be able to read specific tables in a db (db1).
The user will connect from MS access using odbc links (SQL Native client ot SQL Server driver)
I've tried to set up one and once logged on from the user workstation, I can only see sys. tables and INFORMATION_SCHEMA tables.
None of the required db1 tables appear.
under Security/Logins I've created User1:
SQL Server auth. with password
default db = db1
server_roles = none
user mapping = map, db1, user1,dbo
securables = none
status = grant, enabled
on the access db, the odbc link was set up with default db = db1
Why can't I see any of the db1 tables?
How can I restrict access to the sys. tables?
Thank you
View 3 Replies
View Related
May 6, 2002
I am new at the development stages of my DBA career and I am stumped on how to approach this problem, any help would be great.
Problem: Our web developer is designing a Software survey that ranks the difficulty of tasks within a software application like MS Word. Each of these tasks have a rank tied to them.
Here are the tables that he created.
Table 1
EmpID Text
123456 A1, A2, A3
Table 2
ValueID Text Rank
A1 Create Table 1
A2 Insert Query 5
In the text field of table 1 he inserts every task or valueid that the employee is able to do.
He needs to be able to select Empid, text(from table 2), and Rank. Based on need. An example would be 'Which employees can Insert a query'. And he would need to be able to look in the text string on Table 1 and find every A2 in listed then get empid and rank. I know that it can be done with full text searching, however I guess what I want to know is if there is another way to create tables that would jus make a join necessary where the value id can be tied to the empid for each task the employee is able to do?
I hope that this makes sense!!
View 1 Replies
View Related
Nov 29, 2005
Chris writes "How do I create a copy of a table (not temporary).
In Oracle I do .
Create table newtable as select * from oldtable
This command copies data and column data types.
I tried entering
SELECT * INTO db2.dbo.newtable FROM db1.dbo.oldtable
in the query manager and it appears to create the new table, but it only seems to be a temporary table because when I leave query manager and check my data base it isn't there.
I have to convert a table that has about 150 columns and about 2 million rows. I rather not have to create the data types for 150 columns."
View 6 Replies
View Related
Oct 29, 2005
I have an Access 2000 MDB with ODBC linked tables to a SQL Server 7 backend. I currently have a selections table in the front end file which theusers use to make selections of records. The table has two fields -- primarykey (which matches primary key of main, SQL Server table), and a booleanfield. The table is linked to the main table in a heterogeneous inner join.I'm looking to move the table to the back end, while still giving eachmachine a unique set of selections. Using one large table with machine nameas part of the primary key actually slows things down. So I'm consideringusing a series of tables, where each machine has its own table in the backend for selections. The machine name would be incorporated in the particularselections table name, and the front end link would be modified on the flywhen the database is opened to point to that machine's back end selectionstable.This would require having about 50-100 individual selections tables in theback end database. Also, if a machine doesn't have a table when the databaseis opened on that machine, then that table would be created on the fly,populated, and pointed to via the ODBC link.Anyone see any problems with this approach, specifically creating the tableon the fly and then immediately using it, as well as having that many littletables running around? Thanks for any input!Neil
View 31 Replies
View Related
May 1, 2008
I'm transferring data from DB2 to SQL Server - the data gets wiped every night and reloaded. To keep up with any changes in the tables and to reduce the amount of maintenance on keep field & table definition updated, it would be nice to be able to create the tables in SQL Server in the SSIS package, based on the DB2 definition.
I've noticed it can be done in design mode when creating the OLE DB Destination (clicking on the 'New' button), but I'm not sure how I would automate this...
any suggestions?
Thx
View 4 Replies
View Related
Apr 10, 2006
I am trying to go through an arraylist and create some database tables for each entry in the array. what I have is
Dim ques As String
For Each ques In questions
query = "create Table " + ques + " (plantid nvarchar(100), Answer nvarchar(100))"
cmd = New SqlCeCommand(query, con)
cmd.ExecuteNonQuery()
Next
I am wanting to use the item in the arraylist as the name of the db. I am getting an error saying
There was an error parsing the query. [ Token line number = 1,Token line offset = 14,Token in error = 1 ]
Can anyone see what I am doing wrong.
View 5 Replies
View Related
Apr 27, 2007
I have made a new table called 'customer' which i wish to tie into the userId of the db. I have used a db diagram to do this (there are keys on each side of the link and userId is the FK) . When i put the membership/profile view onto the form alongside the new customer table nothing displays in the customer table when i run the app., i dont even see the titles - any ideas (i'm new to this sql malarky btw - so its probably something unbelievably straightforward). Any help appreciated.
Thanks
View 2 Replies
View Related
Apr 7, 2008
Hi All,I will like to create a table from two tables this (explained below) way using a stored procedure. Basically i want the stored procedure to return me the third table but i dont know how to do it.Table ATopicID Topic ----------------------------- 1 Sometopic 12 Some topic 23 Some topic 34 Some topic 4 Table BRateID Rate TopicID---------------------------------------1 5 12 5 13 5 24 4 25 4 36 3 5 Table CTopicID Topic Rate--------------------------------------------1 Some topic1 52 Some topic 2 5 3 Some topic 3 5Basically i have a table that stores topics associated with a particular subject. Those topics are stored in table A above. My users can just read the messages associated with the topic and rate that message. The rating is then stored in table B.Now i will like my users to search for topics with a particular word or sentence in table A and the topics that are returned have a rating they specify. My procedure takes the word or sentence to search in table A and and the rating which will be used in table B. I will like to construct another table that has this newly searched results and return it using a stored procedure or anything simple. I dont know how to do this because i have very little knowledge in stored procedures or sql..... Any help(Code) will be greatly appreciated...
View 11 Replies
View Related
Feb 18, 2004
Hi,
I need to create a table and a few fields in the SQL database programmatically in asp.net.
I know the tabes name, the server which it resides on, username/password. Would anyone have a small sample of this code?
Thanks
rad
View 9 Replies
View Related
Sep 22, 2006
hello
I am working with an existing database and there is no Foreign key between 2 tables
how can i create a FK after , when the tables are allready full ?
product :
product_id
report_id
name
report :
report_id
dateR
i want to create a FK on product.report_id, and ON DELETE CASCADE
thank you
View 2 Replies
View Related
Feb 25, 2004
I'm currently writing a web application in Coldfusion which uses a Access 2000 db. I can create tables in SQL ok but am having problems with the Autonumber type. Any ideas?
View 8 Replies
View Related
Feb 6, 2008
I am very new to SQL Server 2005 so please excuse my mandune queastion.
First what I accomplished was I created several tables within SQL Server 2000 using the Database and Table Wizards. I also created all the relationships the same way. Next, I had SQL Server 2000 and had the tool reverse engineer the SQL for this new database with all the relationships.
My next step was to run this newly created SQL script on my local box with SQL Server 2005 (SMSS). What I did was create the database first and then assign the users to the new database. From here, I moved to running the sql script. While it was not 100% perfect, it did create all the tables and relationships with no problems.
Now, I am trying to accomplish the same process one a development instance of SQL Server 2005, but the script fails. The data base error says the new database created does not exist. When we go back and look at the database within SMSS, it is GONE!
I am at a lost at how to replicate the database I have on my local box. Any suggestions would be greatly appreciated.
Russ
View 2 Replies
View Related
Jul 20, 2005
I am having the following problem and any help would be GREATLYappreciated:In an application I am developing, at some points we create a newtable. When I create this table on another users box, I can not accessit from my box. In sql server I am dbo, but the table created by myapplication when run on a different box has an owner of : "FCxxxx". Ihave sent permissions on this thing to public, but I am still gettingan error when I try to query this thing from my application. And I cannot get query analyzer to recognize this thing. I can see it inEnterprise manager. I would think there is a way to handle this sortof thing. If anyone out there has done anything like this I would bemuch obliged for any ideas. Thanks.Sincerely,Ed HawkesJoin Bytes!
View 1 Replies
View Related
Dec 19, 2006
In sql server 2003 I would create tables with generated sql scripts.
This way I could easily create duplicate dev environments.
Now in SQL 2005 Dev edition I try to run my scripts to create tables.
I create a db [MSS].
They run successfully but there is no table created.
(example script)USE [MSS]
GO
/****** Object: Table [dbo].[KataNames] Script Date: 08/17/2006 13:28:14 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[KataNames](
[Kata] [char](30) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[SequenceId] [int] IDENTITY(1,1) NOT NULL,
[Description] [char](500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Style] [char](25) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
Any clue what else I have to do to let these scripts actually create tables or why if they run ok, where is my table ?
Thanks
Kim Allbritain
View 9 Replies
View Related
Jul 27, 2006
I had a SQL db that i copied all the tables into excel and it generated the quereies in order to create those tables....Is there anyway i could excute all those table creations at once or would it be easier to just write an application that does that for me????
View 5 Replies
View Related
Aug 15, 2015
I have data model as below....I have created a unique constraint as below;
CREATE UNIQUE NONCLUSTERED INDEX [UNQ_StaffIDEventID] ON [dbo].[tblStaffBookings]
(
[StaffID] ASC,
[EventID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
I now tried to create a link between two tables tblStaffBookings and tblEventStaffDisciplinary by dragging from tblEventStaffDisciplinary.StaffID to tblStaff Bookings.StaffID and it gives me error as below;What do I need to do to link tblEventStaffDisciplinary.StaffID to tblStaffBookings.StaffID?
View 15 Replies
View Related