Showing posts with label installation. Show all posts
Showing posts with label installation. Show all posts

Saturday, February 25, 2012

Adding logins via SSEUtil compared to SQL Server Management Studio

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 PCNAME\Instance -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

Just an update.

I did a check within my database and found that the sys.syslogins has the users (when I do a select from the view) but they just don't work. The only difference I can see between my scripted login I created and the SA user is the flag for sysadmin, but thats understandable as these users are not to be sysadmins.

Is there another table that actually enables the login?

DSXC

|||

I noticed a lot of people using the SQLCMD.EXE instead of the SSEUtil.EXE I was using so I thought I'd give it a try.

Lo and behold... it works!

Talk about crazy... oh well. Just so everyone knows, use the SQLCMD.EXE over SSEUtil.exe... gah!

EDIT: I didn't mention the command line to run it...

SQLCMD.EXE -i MYSCRIPT.SQL

Hope that helps.

DSXC

|||

Hi DSXC,

Sorry to have missed this thread earlier, I can shed some light on what you're seeing.

SSEUtil.exe is an unsupported tool primarily used for troubleshooting User Instance problems, it is not meant to be used as a general solution for runing scripts, nor is it licensed to be deployed with your application. Additionally, the default mechanism of SSEUtil works against the User Instance, not the parent instance, so my guess is it was not working the way you think it was.

SQLCmd is the general scripting utility that is installed with all copies of SQL 2005 and is exactly the tool you should be using for what you wish to accomplish, but you've already discovered that.

Mike

|||

Hi Mike,

Thanks for your response. It makes a bit more sense now.

I found the SSEUtil app with a search on attaching the database to my SQL Server so I guessed it would have worked running scripts against it also. I just noticed that the SSEUtil doesn't attach my database correctly either so I've now transferred over to using another SQL script.

Again thanks for your response.

DSXC

Thursday, February 16, 2012

Adding Custom component to the Tool Box

Hi,

I was trying the SSIS programming samples,that comes with installation of SQL Server 2005, I want to load the ChangeCase DLL in the toolbox.

The readMe file gives the direction. It does not work. It says you will see component in once you see DataFlow Task button( clicking Choose Items in the tools box).

I cannot load the custom component to the toolbox, Can I get some help.

Thank you,

Have a quick look at this -

How do I install a task or transform component? - http://www.konesans.com/faq.aspx#installtask

You do not see you component in the "SSIS Data Flow Items" tab? If it is not listed there, then it is not installed correctly. Components must be place in the GAC so that they can be found at run-time. They must also be placed in the SSIS specific PipelineComponents folder so that they can be found by the designer. This is where the Choose Toolbox stuff looks. By default this is -

C:\Program Files\Microsoft SQL Server\90\DTS\PipelineComponents

The location is actually defined in a registry key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\AssemblyFolders\DTS Pipeline Components". The AssemblyFolders is where VS searches for assemblies that can be added like this.

Monday, February 13, 2012

Adding buttons Pl help me

Hi
I installed Microsoft SQl Server Reporting services server in one of our server(which doesn't have .NET Installation) and installed the client in my development machine.I already installed Microsoft VS.NET 2003 in my PC.
I already installed Microsoft SQl Server Reporting services
service pack 1 in my server and client machines.
I am developing the reports in my client machine using Reports Project template.I created one sample project and created sample reports ,those reports can view in WEB browser successfully.Now i want place my own button in default toolbar ,when ever user press that button page want to redirect some other aspx page.How and where i have to do it.I am developing reports in client pc so i dont find any script file in my project.
Pl advice me where i have to do settings or coding to do this simple task.
thanks.There is no way to extend the built-in toolbar. If you want to add
additional functionality, you need to create a separate aspx page similar to
the way Report Manager works. It adds its own toolbars and links on an aspx
page and contains an iframe to the reportserver vroot.
--
This posting is provided "AS IS" with no warranties, and confers no rights
"sr" <sr@.discussions.microsoft.com> wrote in message
news:FCB8098F-F906-4BF9-BA68-083FD4BEE9A4@.microsoft.com...
> Hi
> I installed Microsoft SQl Server Reporting services server in one of our
server(which doesn't have .NET Installation) and installed the client in my
development machine.I already installed Microsoft VS.NET 2003 in my PC.
> I already installed Microsoft SQl Server Reporting services
> service pack 1 in my server and client machines.
> I am developing the reports in my client machine using Reports Project
template.I created one sample project and created sample reports ,those
reports can view in WEB browser successfully.Now i want place my own button
in default toolbar ,when ever user press that button page want to redirect
some other aspx page.How and where i have to do it.I am developing reports
in client pc so i dont find any script file in my project.
> Pl advice me where i have to do settings or coding to do this simple task.
> thanks.