Adding Logins Via SSEUtil Compared To SQL Server Management Studio

Feb 7, 2007

Hello all,

I am currently in the process of setting up an SQL Server Express installation that comes packaged with an application I have written. My problem is that I want to use SQL Server user management (not just windows users) which work fine if I set them up manually. I started writing a script that I have SSEUtil execute once the application is fully installed (a step in my installation script) which sets up the users and passwords etc. The script is similar to the following:

USE [DBName]
GO

EXEC sp_DropUser 'user1'
EXEC sp_DropUser 'user2'
EXEC sp_DropUser 'user3'
EXEC sp_DropUser 'user4'
GO

USE [master]
GO

EXEC sp_DropLogin 'user1'
EXEC sp_DropLogin 'user2'
EXEC sp_DropLogin 'user3'
EXEC sp_DropLogin 'user4'
GO

CREATE LOGIN user1 WITH Password = 'user1', CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
CREATE LOGIN user2 WITH Password = 'user2', CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
CREATE LOGIN user3 WITH Password = 'user3', CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
CREATE LOGIN user4 WITH Password = 'user4', CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
GO

USE [DBName]
GO

EXEC sp_AddUser 'user1'
EXEC sp_AddUser 'user2'
EXEC sp_AddUser 'user3'
EXEC sp_AddUser 'user4'
GO

ALTER USER user1 WITH DEFAULT_SCHEMA = MySchema
ALTER USER user2 WITH DEFAULT_SCHEMA = MySchema
ALTER USER user3 WITH DEFAULT_SCHEMA = MySchema
ALTER USER user4 WITH DEFAULT_SCHEMA = MySchema
GO

REVOKE ALTER,DELETE,INSERT,SELECT,UPDATE ON MySchema.Table1 FROM MyRole
REVOKE ALTER,DELETE,INSERT,SELECT,UPDATE ON MySchema.Table2 FROM MyRole
REVOKE ALTER,DELETE,INSERT,SELECT,UPDATE ON MySchema.Table3 FROM MyRole
REVOKE ALTER,DELETE,INSERT,SELECT,UPDATE ON MySchema.Table4 FROM MyRole
GO

EXEC sp_DropRole 'MyRole'
EXEC sp_AddRole 'MyRole'
GO

GRANT ALTER,DELETE,INSERT,SELECT,UPDATE ON MySchema.Table1 TO MyRole
GRANT ALTER,DELETE,INSERT,SELECT,UPDATE ON MySchema.Table2 TO MyRole
GRANT ALTER,DELETE,INSERT,SELECT,UPDATE ON MySchema.Table3 TO MyRole
GRANT ALTER,DELETE,INSERT,SELECT,UPDATE ON MySchema.Table4 TO MyRole
GO

EXEC sp_AddRoleMember 'MyRole','user1'
EXEC sp_AddRoleMember 'MyRole','user2'
EXEC sp_AddRoleMember 'MyRole','user3'
EXEC sp_AddRoleMember 'MyRole','user4'
GO

Now if I run this script from within SQL Server Management Studio it executes perfectly. The logins add, the role is added, each user is added to the database logins and assigned to the role, the schema is set correctly on each user.

Then when I try to run the exact same script from the SSEUtil application (SSEUTIL -s PCNAMEInstance -run USERS.SQL), it processes everything, except the Logins.

This is frustrating as it means to install for a client I would need to either get them to open the management console and run the script from there, or I have to go to site just to setup users.

Am I on the right track? Or is there another way to automate the adding of Logins?

Thanks in advance,

DSXC

View 5 Replies


ADVERTISEMENT

SQL Server Management Studio Express: User Instances Listed/founded In SSEUtil - How They Got In And Stay In SSEUtil?

Nov 23, 2007

I have used SQL Server Management Studio Express (SSMSE) and Visual Basic 2005 Express (VBE) for more than one year to pick up the Transect-SQL, ADO.NET 2.0, SQL Server 2005 Express, SQLCLR, etc. Yesterday, I used SSEUtil to execute:
C:SSEUtil>SSEUtil -l
I got the following:
1. master
2. tempdb
3. model1
4. msdb
5. 56713D4D965AE4455_TSVISUAL STUDIO 2005PROJECTSMYFIRSTAPPSSE-VBEXPRESS-WINDOWSAPPLICATION1BINDEBUGMYDB1.MDF
6. C:DOCUMENTS AND SETTINGSCOTT H CHANGMY DOCUMENTSVISUAL STUDIO 2005PROJECTSMASTERDETAILMASTERDETAILBINDEBUGMYDB1.MDF
7. C:ADONET2CODE-JOHNSONVBCHAPTER02CONNECTEDCLASSESSETBINDEBUGPUBS.MDF
8. C:PROGRAM FILESMICROSOFT SQL SERVERMSSQL.1MSSQLDATANORTHWIND.MDF
9. C:ADVENTUREWORKSLTADVENTUREWORKSLT_DATA.MDF
I created some VBE projects and used some examples from some tutorial books and websites in the past. But, I thought that user instance timeout is 60 minutes and user instances should be gone after 60 minutes. Why do I have the above-mentioned user instances remained in SSEUtil now? Please explain this thing for me.

Thanks,
Scott Chang

View 5 Replies View Related

ADO.NET Returns Different Colum Value When Compared To View Results In SQL 2005 Management Studio

Feb 7, 2007

I have a complex view in my sql 2005 database.
The view returns a column that could be null (as the result of a left outer join).
The coulmn that is returned is an integer.
Everything works fine if I run the view from SQL 2005 Management Studio.
My column value is always null if I use ADO.NET's SqlAdapter to return a DataTable.
Has anybody seen this behaviour before?
Any help appreciated.
Regards,
Paul.

View 2 Replies View Related

Adding Images With SQL Server Express Management Studio

Aug 4, 2006

Can I add images to a table with SQL Server Express Management Studio? If so, how, if not, what alternative methods other than the point-and-click can I use?

Thanks in advance,

Fedor Steeman

View 1 Replies View Related

Adding Integration Services Node In Server Management Studio

Jun 15, 2005

Hi,

View 8 Replies View Related

Creating A Table And Adding Rows To Database In Studio Management

Aug 12, 2015

I am trying to use the following Query to create the table Agents and add rows to it.

USE REMAXCLASSIC;
IF OBJECT_ID ('dbo.Agents', 'U') IS NOT NULL
DROP TABLE Agents;
GO
CREATE TABLE Agents

[Code] ....

I get the following error messages:

Msg 102, Level 15, State 1, Line 34 Incorrect syntax near '0.25'
Msg 105, Level 15 mark after the character string ');

View 2 Replies View Related

SQL Server Management Express Studio Management Tools

Apr 5, 2007



I have recently installed the SQL Server Management Studio Express but I do not find Management Tools in order to create scheduled backups and shrinking of the databases. I was under the impression that this should be included in the Management Studio. I use the SQL 2005 Express for smaller customers who run the SQL on a desktop unit. I need a way to backup the data to a server machine for backup purposes. I have uninstalled and reinstalled to no avail.

View 7 Replies View Related

Visual Studio Database File And SQL Server Management Studio Express Question

Mar 17, 2007

I have a database in my "App_Data" folder of my visual studio project.  I can view it fine in Visual Studio's built-in tools for managing a database attached to a solution.  However i recently started playing around with the SQL Server Management Studio Express program.  When i attach my database to Management Studio, and try to run my program it crashes.  I think it might be a permissions error?!? When i detatch it and reattach it in visual studio it runs fine again.   Any suggestions? ThanksJason 

View 1 Replies View Related

Visual Studio 2005 Standard And SQL Server Management Studio?

Sep 4, 2007

I am new to visual studio and I am still not sure of all its components and features.

I installed visual studio 2005 standard edition but cannot find SQL Server Management Studio?

I guess this must be because it is not included with Visual studio 2005 standard. Is it included with VS 2005 professional?

I want to add pictures of products to my shopping site using an SQL database and I’ve been told that SQL Server Management studio is required as it is a graphical tool.

How would I go about obtaining the SQL server management studio. There seems to be different versions of SQL server that it is confusing to know which one to purchase.

Will the SQL server 2005 version that comes with Visual studio standard be sufficient for me now right? I want to create a shopping site with hundreds, perhaps even thousands of products. I want to use an SQL server 2005 database. The database will include ‘dynamically generated’ product images if that is the correct terminology.

My goodness, it seems I still have so much to learn.

Thanks

View 1 Replies View Related

How Do I Get The Database That I Am Using In Visual Studio Into My SQL Server Management Studio?

Sep 12, 2007

How do i get the database that i am using in visual studio into my SQL server management studio?
i need to create some scripts to create stored procedures on a live server.

View 1 Replies View Related

SQL Server Managment Studio Repeated Logins

Jan 11, 2008



Presumably an easy question but every time I open a query file the SSMS requires me to login. Very frustrating. Cannot find a configuration option, properties attribute or other to turn this off. Can anyone adivse how I can set up SMSS to require a login at the beginning of the session and then not again for each saved query I open?

Thanks.

View 3 Replies View Related

Adding SQL Server Reports In RMS(Retail Management System)

Nov 13, 2007


Hi ,
i hav a problm ,How can i see sql sever reports in RMS,(Retail managmt System),How can we add these reports on that?

Thanks in advance..
Jo

View 7 Replies View Related

Management Studion Express Alongside Full-blown Management Studio?

Oct 9, 2006

Is it possible to run both Sql Server Management Studio: Express and full blown side by side?

I am developing with the full blown product but would like to test Management Studio Express on the same box.
Is this possible?

Thanks

Eric

View 3 Replies View Related

SQL Server Management Studio

Sep 22, 2006

I have SQL server 2005 developer edition installed on my machine.  I was expecting something like Enterprise manager to manage databases but nothing is installed by default.  Ive found SQL server management studio express and installed it, but Ive also seen references to SQL Server Management Studio.  Are there any differences between the two , or are they the same and are just described differently ??  Im a bit confused, Microsoft should make this clear.

View 4 Replies View Related

SQL Server Management Studio

Oct 1, 2007

Hey everyone,
     Would someone please tell me why the new SQL Server Managment Studio comes with hardly not frills?  What happened to the SQL Enterprise Manager in SQL Server 2000? It had DTS, SQL Agent Job and step viewing, Cool Wizards.. All that great stuff. but with this new Sql Server Management Studio with 2005 all I can do is pretty much look at the data and write queries and create and modify tables. Am I missing something?
I did download an external tool which was called an import/export wizard but it sucks compaired to the DTS in SQL 2000.
I did notice when I open my Sql Server Management Studio "Express" that it is the Express version... Is there a difference?
Thanks for any help.

View 3 Replies View Related

About SQL Server Management Studio Help!!!

Jan 29, 2008

i have SQL Server 2005 dev edition and i wanted to use SQL Server Management Studio so is it installed or i need to install the SQL Server Management Studio  express edition ???
thx

View 1 Replies View Related

SQL Server Management Studio

May 21, 2008

I have installed SQL Server Management Studio (for SQL2005) to a pc. When the user boots the pc, the following error is received:

fmaagent.exe - Common Language Runtime Debugging Services
Application has generated an exception that could not be handled.
Process id =0x328 (808), Thread id=0x32c (812).

Click Ok to terminate the application.
Click CANCEL to debug the application.

After clicking on OK, the pc continues on its merry way and boots up successfully.

Does anyone know what would cause this error? I have checked the Microsoft site but did not find this error listed among the documents.

The PC is running Windows XP.

Thanks in advance.

View 1 Replies View Related

SQL Server Management Studio

Sep 29, 2004

Good Afternoon! I installed SQL Server Express 2005 but the GUI is not visible. Someone can tell me how to install it or where I can find the executable.

Thanks.

View 2 Replies View Related

SQL Server Management Studio

Jul 13, 2006

David writes "I am kind of new to SQL Server Management Studio.
How do I export tables and stored procedures from a database on my PC to a database by the same name located on a remote server."

View 1 Replies View Related

SQL Server Management Studio

Jan 9, 2007

Can I set a passport protection to a database (once I am connected to the SQL Server on my own machine) from not opening/browsing/stop even read access?

(I want something like log in authentication before I open/browse/double click on any database to expand basically)

Thanks for help
J.

View 3 Replies View Related

Where Is SQL Server Management Studio?

May 4, 2007

I installed SQL 2005 in a few server but none of them have SQL Server Management Studio.
Where to find out them?
I checked c:...inn, there is now VSShell folder.

View 4 Replies View Related

SQL Server Management Studio

Mar 8, 2007

This is probably a noob question, but is it possible to install SQL Server Management Studio on a remote machine (i.e. my laptop)?

View 1 Replies View Related

Where Is SQL Server Management Studio?

Feb 22, 2006

I have the "Ready to Launch" package, which includes Vidual Studio 2005 Standard Edition, SQL Server 2005 Standard Edition and something else called BizTalk Server 2006.

Anyway, Visual Studio is spread across two CD's and I have installed that. I now want to use the SQL Server Management Studio to administer a database I have running on a website. Anyway, SQL Server is on a DVD and when I put it into the drive it comes up with the autorun screen. I noticed that in the top left corner of this screen it says "SQL Server 2005 (Disc 1 of 2). However, there is no second disc, so I'm wondering if this is a problem or just a typo left over from the CD version.

There is two options in the menu under Install, "Server Components, tools, Books Online, and samples" and "Run the SQL Native Client Installation Wizard." I have tried both of these options and I still don't have the SQL Server Management Studio. In fact if I select the first option, when I get half way through the wizard, it asks what components I want installed. I cannot see any reference to the SQL Server Management Studio in this list, so I just select everything to be sure.

Once it has finsihed installing, all it does is create a Start Menu folder called "Microsoft SQL Server 2005" and another folder inside that called "Configuration Tools." This folder just contains a few things like configuration manager and surface area configuration, etc...

So where do I find this SQL Server Management Studio? Have I done something wrong or am I missing something (like a second disc)? I'm installing on to Windows XP, would that cause the problem? Do I need to be installing on to some sort of server OS (which I don't have BTW as I'm just a regular user looking for a way to administer my MS SQL database and I heard this tool was the way to go)?

View 4 Replies View Related

Using SQL Server Management Studio

Jun 25, 2007

Hi everyone,



I am trying to connect to my reporting server, but in Management Studio

my server type only shows 'Database Engine'. I have SQL Server Reporting Services running and I can connect to the report manager.



I would like to define a new role in Management Studio, how can I do this?



Also, in my report manager site, I do have the link to add roles.

View 2 Replies View Related

I Need SQL Server Management Studio!

Aug 16, 2007

Hi,

I have just completely installed MS SQL Server 2005 Express Edition in MS Server 2003.
After installation, I only have the Configuration Manager, Error and Usage Reporting and Surface Area Configuration, listed under Configuration Details.

SQL Server Management Studio is not accessible anywhere.
I also do not have the folder C:Program FilesMicrosoft SQL Server90ToolsBinnVSShell in which the SQL Server Management Studio is installed.
What must I do to get this component installed?

In this article http://msdn2.microsoft.com/en-us/library/ms143219.aspx, it is also written in step 8 that there should be a "Components to Install" page. I have done the installations and uninstallations a few times, but I still do not have "Components to Install" page. In fact, after step 7, I am brought to the "Features Selection" page.

What can I do to solve this problem? Please help.

Thanks.

View 3 Replies View Related

SQL Server Management Studio

Jun 8, 2007

During SQL 2005 Standard edition the Management Studio did not install. how can I get it to install?

View 8 Replies View Related

SQL Server Management Studio

Jul 31, 2006

When attempting to start the SQL Server 2005 Management Studio from the Start Menu on my Windows 2003 SP1 server, I quickly get the error, "The Application failed to initialize properly (0x80000003). click on OK to erminate the application. I am accessing the server from my Windows XP Workstion using Timbuktu Pro Remote control software. I have no problem attaching to the SQL Server database on this server when connecting to it from my Workstation install of Management Studio. The SQL Server Business Intelligence Studio launches fine in the Timbuktu session as does SQL Server Configuration Manager. The Configuration manager shows all services (for both my Default and Named Instance) in the Running state.

Please help.

Rob

View 4 Replies View Related

Sql Server Management Studio

Apr 25, 2007

In 2005 Query Analyzer no longer exists and the query is integrated with management studio. I have some users that want to query the database but I don' t want these users to have the ability to use anything else in the Management Studio - restore databases, detach, etc. Anyone have any ideas how this might be done? Thanks.

View 1 Replies View Related

Where Do I Buy SQL Server Management Studio?

Sep 8, 2007

I have the Express version but now need the full tool set. I've been looking for the last half hour on Microsoft.com and elsewhere, and can find absolutely anything I could want to know about the program except how to purchase it. I feel kind of stupid, but I have to ask: where the hell do you buy this thing?? :-)

Thanks.

Jeff

View 8 Replies View Related

SQL Server Management Studio

Apr 18, 2007

I've install SQL Server 2005 Enterprise Evaluation Edition but the Management Studio was not installed. Is this normal? If yes how can I get the Management Studio



Thks

View 4 Replies View Related

Where Is SQL Server Management Studio

May 8, 2007

I just had to do a total restore on one of my machines that has a copy of SQL Server 2005. Luckily, this is not the production server. But when I reinstalled SQL Server, I now do not have the option to get into SQL Server Management Studio. Why would this be?



Everything seemed to install okay - including Reporting Services.



Thanks for the information.

View 3 Replies View Related

Adding Logins And Permissions

Jun 9, 2006

Hi,

I am at a company with 18 employees and I have 11-12 databases in SQL
server. I can't seem to give logins and permissions to groups. Is there
a simpler way, or do I have to add every single employee to each
database and give permissions?

View 1 Replies View Related

Server Management Studio Express

Jul 15, 2006

I just installed Server Management Studio Express, but there is an error when I run the application. This is the message:

"Unhandled exception has occurred in a component in your application.
If you click Continue, the application will ignore this error and
attempt to continue.

Cannot create a stable subkey under a volatile parent key."


And there is also an error when I try to open a file from my local
machine. The error occurs when I click File > Open > File...
The error cause the application has to close. See this link below:
SQL Error.

Many many thanks for the help in advanced!

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved