Showing posts with label object. Show all posts
Showing posts with label object. Show all posts

Tuesday, March 27, 2012

default dbo to object names instead of user name

Several developers have been assigned dbo of a database. Is there a way to
allow all the objects that we create to all have the dbo ownership by
default, rather than our user name?
I'm aware that we could explicitly type ...
create proc dbo.myprocedurename as
but was hoping this could be the default behavior.
Thanks in advance.
Mark
Mark,
I assume you mean they have been assigned the db_owner role? Only one login can be the dbo user. There is a
difference between dbo and db_owner.
Assuming that the logins have their own user names and are indeed db_owner, then you have to qualify the owner
when you create the object. Only way around is to use sp_addalias, but this will disappear in future and
there's no GUI support for this. Be careful to read in BOL whether it is supported or not.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"Mark" <mfield@.idonotlikespam.cce.umn.edu> wrote in message news:%23GgYl4dMEHA.1392@.TK2MSFTNGP09.phx.gbl...
> Several developers have been assigned dbo of a database. Is there a way to
> allow all the objects that we create to all have the dbo ownership by
> default, rather than our user name?
> I'm aware that we could explicitly type ...
> create proc dbo.myprocedurename as
> but was hoping this could be the default behavior.
> Thanks in advance.
> Mark
>
|||Mark wrote:

> Several developers have been assigned dbo of a database. Is there a way to
> allow all the objects that we create to all have the dbo ownership by
> default, rather than our user name?
could you put all those developers into a group on the db server and then have
that group be the dbowner of the db?

default dbo to object names instead of user name

Several developers have been assigned dbo of a database. Is there a way to
allow all the objects that we create to all have the dbo ownership by
default, rather than our user name?
I'm aware that we could explicitly type ...
create proc dbo.myprocedurename as
but was hoping this could be the default behavior.
Thanks in advance.
MarkMark,
I assume you mean they have been assigned the db_owner role? Only one login
can be the dbo user. There is a
difference between dbo and db_owner.
Assuming that the logins have their own user names and are indeed db_owner,
then you have to qualify the owner
when you create the object. Only way around is to use sp_addalias, but this
will disappear in future and
there's no GUI support for this. Be careful to read in BOL whether it is sup
ported or not.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"Mark" <mfield@.idonotlikespam.cce.umn.edu> wrote in message news:%23GgYl4dMEHA.1392@.TK2MSFTN
GP09.phx.gbl...
> Several developers have been assigned dbo of a database. Is there a way t
o
> allow all the objects that we create to all have the dbo ownership by
> default, rather than our user name?
> I'm aware that we could explicitly type ...
> create proc dbo.myprocedurename as
> but was hoping this could be the default behavior.
> Thanks in advance.
> Mark
>|||Mark wrote:

> Several developers have been assigned dbo of a database. Is there a way t
o
> allow all the objects that we create to all have the dbo ownership by
> default, rather than our user name?
could you put all those developers into a group on the db server and then ha
ve
that group be the dbowner of the db?sql

default dbo to object names instead of user name

Several developers have been assigned dbo of a database. Is there a way to
allow all the objects that we create to all have the dbo ownership by
default, rather than our user name?
I'm aware that we could explicitly type ...
create proc dbo.myprocedurename as
but was hoping this could be the default behavior.
Thanks in advance.
MarkMark,
I assume you mean they have been assigned the db_owner role? Only one login can be the dbo user. There is a
difference between dbo and db_owner.
Assuming that the logins have their own user names and are indeed db_owner, then you have to qualify the owner
when you create the object. Only way around is to use sp_addalias, but this will disappear in future and
there's no GUI support for this. Be careful to read in BOL whether it is supported or not.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"Mark" <mfield@.idonotlikespam.cce.umn.edu> wrote in message news:%23GgYl4dMEHA.1392@.TK2MSFTNGP09.phx.gbl...
> Several developers have been assigned dbo of a database. Is there a way to
> allow all the objects that we create to all have the dbo ownership by
> default, rather than our user name?
> I'm aware that we could explicitly type ...
> create proc dbo.myprocedurename as
> but was hoping this could be the default behavior.
> Thanks in advance.
> Mark
>|||Mark wrote:
> Several developers have been assigned dbo of a database. Is there a way to
> allow all the objects that we create to all have the dbo ownership by
> default, rather than our user name?
could you put all those developers into a group on the db server and then have
that group be the dbowner of the db?

Friday, February 24, 2012

Debugging Stored Proc

Hi,
When I go to debug any SP thru Object browser in query analyser ... it
starts well ... takes all the required parameters to begin ... but when I
click on execute button, it completes the SP execution immediately. It does
not allow to use functions like Step into, Step over etc ... Why does this
happen?
Because of this, my main purpose of debugging any SP, does not get satisfied
.
Pls Help."Krishnapra Paralikar" <Krishnapra
Paralikar@.discussions.microsoft.com> wrote in message
news:9DDB8999-67C1-44C8-ADD6-B2979892E612@.microsoft.com...

> When I go to debug any SP thru Object browser in query analyser
http://www.sql-server1.org/detail-7330883.html

Debugging Report Manager

Hi,
I have created a custom data processing extension that retrieves a Data
Table object from my DAL. It all works fine in the report designer, I can
preview the report and data is returned etc However when I deploy the report
and then try to access via the report manager web interface I get an error
has occurred during report processing... I can't for the life of me see what
is could be causing the error and I don't know how to debug this
Can anyone provide any useful tips/tricks?
ThanksMy bet is that dotnet security is tripping you up. When in development you
are the admin of the box and have all the rights you need to do anything.
The context of your assembly in production is different and you need to
setup the rights for the assembly. That is my guess anyway.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Neil" <Neil@.discussions.microsoft.com> wrote in message
news:B8854717-92A7-4ED1-8FDC-0D8462A594AB@.microsoft.com...
> Hi,
> I have created a custom data processing extension that retrieves a Data
> Table object from my DAL. It all works fine in the report designer, I can
> preview the report and data is returned etc However when I deploy the
> report
> and then try to access via the report manager web interface I get an error
> has occurred during report processing... I can't for the life of me see
> what
> is could be causing the error and I don't know how to debug this
> Can anyone provide any useful tips/tricks?
> Thanks
>

Tuesday, February 14, 2012

Debug Error - Object variable or With block variable not set -

I keep getting this debug error, see my code below, I have gone thru it time and time agian and do not see where the problem is. I have checked and have no NULL values that I'm trying to write back.

~~~~~~~~~~~

Error:

System.NullReferenceException was unhandled by user code
Message="Object variable or With block variable not set."
Source="Microsoft.VisualBasic"

~~~~~~~~~~~~

My Code

Dim DBConnAs SqlConnection

Dim DBAddAsNew SqlCommand

Dim strConnectAsString = ConfigurationManager.ConnectionStrings("ProtoCostConnectionString").ConnectionString

DBConn =New SqlConnection(strConnect)

DBAdd.CommandText ="INSERT INTO D12_MIS (" _

&"CSJ, EST_DATE, RECORD_LOCK_FLAG, EST_CREATE_BY_NAME, EST_REVIEW_BY_NAME, m2_1, m2_2_date, m2_3_date, m2_4_date, m2_5, m3_1a, m3_1b, m3_2a, m3_2b, m3_3a, m3_3b" _

&") values (" _

&"'" & Replace(vbCSJ.Text,"'","''") _

&"', " _

&"'" & Replace(tmp1Date,"'","''") _

&"', " _

&"'" & Replace(tmpRecordLock,"'","''") _

&"', " _

&"'" & Replace(CheckedCreator,"'","''") _

&"', " _

&"'" & Replace(CheckedReviewer,"'","''") _

&"', " _

&"'" & Replace(vb2_1,"'","''") _

&"', " _

&"'" & Replace(tmp2Date,"'","''") _

&"', " _

&"'" & Replace(tmp3Date,"'","''") _

&"', " _

&"'" & Replace(tmp4Date,"'","''") _

&"', " _

&"'" & Replace(vb2_5,"'","''") _

&"', " _

&"'" & Replace(vb3_1a,"'","''") _

&"', " _

&"'" & Replace(vb3_1b,"'","''") _

&"', " _

&"'" & Replace(vb3_2a,"'","''") _

&"', " _

&"'" & Replace(vb3_2b,"'","''") _

&"', " _

&"'" & Replace(vb3_3a,"'","''") _

&"', " _

&"'" & Replace(vb3_3b,"'","''") _

&"')"

DBAdd.Connection = DBConn

DBAdd.Connection.Open()

DBAdd.ExecuteNonQuery()

DBAdd.Connection.Close()

Has nothing to do with NULL values, it's a null reference. In better VB-speak, you've accessed a method or property on an object that you haven't initialized.

For example:
Dim conn as sqlconnection

conn.open

Notice, conn was never set to a sqlconnection, hence, it's nothing (Nothing is vb-speak for C#/C++'s null).

My guess is that you don't actually have your web.config set up correctly. More specifically, you don't have a connection string named "ProtoCostConnectionString" in the connectionstrings section. Note, that is NOT the same as the appsettings section.

Also, you really should use a parameterized query, and if you are going to be concatenating more than a few lines of strings, you'd be much better off using the stringbuilder class if you absolutely MUST continue using string concatenation as how you build your SQL commands.

|||Thanks, I will rewrite this procedure and will use "parameterized query" instead of the string variable.