Tuesday, March 20, 2012
script search for "dbo" in a database.
"dbo" role.Hi Grazyna
dbo is not a role, it is a user and in SQL 2005, it is also a schema.
Do you mean that you want to find members of the db_owner role?
If so, you use the following stored procedure:
EXEC sp_helprolemember db_owner
HTH
Kalen Delaney, SQL Server MVP
www.InsideSQLServer.com
http://sqlblog.com
"Grazyna" <Grazyna@.discussions.microsoft.com> wrote in message
news:31129F0B-2C16-48CE-905B-93803F11D42B@.microsoft.com...
>I am looking for a script to find out all userid's in a database that have
> "dbo" role.|||Thank you. Yes, this is very close to what I need. Thank you very much for
this tip.
"Kalen Delaney" wrote:
> Hi Grazyna
> dbo is not a role, it is a user and in SQL 2005, it is also a schema.
> Do you mean that you want to find members of the db_owner role?
> If so, you use the following stored procedure:
> EXEC sp_helprolemember db_owner
> --
> HTH
> Kalen Delaney, SQL Server MVP
> www.InsideSQLServer.com
> http://sqlblog.com
>
> "Grazyna" <Grazyna@.discussions.microsoft.com> wrote in message
> news:31129F0B-2C16-48CE-905B-93803F11D42B@.microsoft.com...
>
>|||I think,I can also modify code used in sp_helplogins to just list me the
users who are members of db_owner role. Thank you for your help.
"Kalen Delaney" wrote:
> Hi Grazyna
> dbo is not a role, it is a user and in SQL 2005, it is also a schema.
> Do you mean that you want to find members of the db_owner role?
> If so, you use the following stored procedure:
> EXEC sp_helprolemember db_owner
> --
> HTH
> Kalen Delaney, SQL Server MVP
> www.InsideSQLServer.com
> http://sqlblog.com
>
> "Grazyna" <Grazyna@.discussions.microsoft.com> wrote in message
> news:31129F0B-2C16-48CE-905B-93803F11D42B@.microsoft.com...
>
>
Tuesday, February 21, 2012
Scope_identity equal to 0 from a stored proc as we
Create PROCEDURE dbo.InsertAccount
@.AccRisAsse bit,
@.AccHldBll bit,
@.Acctaxexm bit
AS
insert into TblAccount(AccRisAsse,AccHldBll,Acctaxexm)
values(@.AccRisAsse,@.AccHldBll,@.Acctaxexm)
return scope_identity()
GO
And here is the code in .Net to run the proc and get back the scope_identity:
I delcare my sqlCommand sqlcmdInsNeAcc and connection fromsystem.data.Sqlclient, I open my connection. all goes well then I do:
sqlcmdInsNeAcc.type=commandtype.storedprocedure
sqlcmdInsNeAcc.CommandText = "InsertAccount"
pm =sqlcmdInsNeAcc.Parameters.Add(New SqlParameter("@.AccountNumber",SqlDbType.BigInt))
pm.Direction = ParameterDirection.ReturnValue
Dim kAccountNumber as integer
kAccountNumber = sqlcmdInsNeAcc.Parameters("@.AccountNumber").Value
pm =sqlcmdInsNeAcc.Parameters.Add(New SqlParameter("@.AccRisAsse",SqlDbType.Bit))
pm.Value = myvalue1
pm =sqlcmdInsNeAcc.Parameters.Add(New SqlParameter("@.AccHldBll",SqlDbType.Bit))
pm.Value = myvalue2
pm =sqlcmdInsNeAcc.Parameters.Add(New SqlParameter("@.Acctaxexm",SqlDbType.Bit))
pm.Value = myvalue3
sqlcmdInsNeAcc.executenonquery
then when I try to display the value of my returned scope identity from the variable: kAccountNumber
ALL I GET IS ZERO although my row is created in the table with the right Account number
Thanks
you should move
kAccountNumber = sqlcmdInsNeAcc.Parameters("@.AccountNumber").Value
to blow the
sqlcmdInsNeAcc.executenonquery
Hope this help
|||that helped perfectly. am thankful