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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Transactions problem

Author  Topic 

boreddy
Posting Yak Master

172 Posts

Posted - 2010-02-24 : 23:55:12
When i am adding roles on a xp machine, using transactions of SQL it is working fine.
But i am facing problems with a VISTA machine, as the same script with transactions is not creating roles on VISTA machine.

this is the my procedure and executon

Create PROCEDURE [dbo].[spGrantPermissions]
@Name varchar(100)

AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
DECLARE @String varchar(1000),
@String1 varchar(1000),
@String2 varchar(1000),
@UserIP varchar(50)
Begin try
begin transaction

SET @String1 = ' CREATE USER ['+ @Name +']'
EXEC (@String1)
SET @String1 = ' EXEC sp_addrolemember'+ '''' + 'db_owner' + '''' + ',' +'[' + @Name +']'
EXEC (@String1)
Commit Transaction
End try
Begin catch
rollback transaction
end catch

END

the below is the exicution(in xp os it is working fine(adding the roles) but in vista it is not working(not adding the roles))

declare @Host varchar(200)
set @Host = (select host_Name())
set @Host = @Host+ '\ASPNET'
--one execution
exec spGrantPermissions @Host


--second executiopn
set @Host = 'NT AUTHORITY\NETWORK SERVICE'
exec spGrantPermissions @Host

pk_bohra
Master Smack Fu Yak Hacker

1182 Posts

Posted - 2010-02-25 : 00:07:20
Why u are creating another thread for same question..

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=140239
Go to Top of Page
   

- Advertisement -