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

Friday, March 30, 2012

how to rename a temp table

EXEC sp_rename '#customers', '#custs'
result with error :Invalid object name '#customers'.
how to rename a temp table?Sam
sp_rename
Changes the name of a user-created object (for example, table, column, or
user-defined data type) in the current database.
"Sam" <focus10@.zahav.net.il> wrote in message
news:ecE3BxurFHA.2008@.TK2MSFTNGP10.phx.gbl...
> EXEC sp_rename '#customers', '#custs'
> result with error :Invalid object name '#customers'.
> how to rename a temp table?
>
>|||Sam wrote:
> EXEC sp_rename '#customers', '#custs'
> result with error :Invalid object name '#customers'.
> how to rename a temp table?
I'm not sure you can rename a temporary table. Why do you need to do
this?
David Gugick
Quest Software
www.imceda.com
www.quest.com|||so how can i rename the temp table?
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:OziOz4urFHA.240@.tk2msftngp13.phx.gbl...
> Sam
> sp_rename
> Changes the name of a user-created object (for example, table, column, or
> user-defined data type) in the current database.
>
>
>
> "Sam" <focus10@.zahav.net.il> wrote in message
> news:ecE3BxurFHA.2008@.TK2MSFTNGP10.phx.gbl...
>|||I don't think there's a documented way to do it.
Why would you ever want to rename a temp table? This seems especially
pointless with a local temp table, which after all is intended
precisely to give you a locally-scoped name for the table. I'm sure if
you explain your requirement we can suggest a better solution to avoid
doing this.
David Portas
SQL Server MVP
--|||Uri, I believe sp_rename disallows renaming temp objects.
Hope this helps.
Dan Guzman
SQL Server MVP
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:OziOz4urFHA.240@.tk2msftngp13.phx.gbl...
> Sam
> sp_rename
> Changes the name of a user-created object (for example, table, column, or
> user-defined data type) in the current database.
>
>
>
> "Sam" <focus10@.zahav.net.il> wrote in message
> news:ecE3BxurFHA.2008@.TK2MSFTNGP10.phx.gbl...
>|||select * into #NewName from #OldName
drop table #OldName
--Brian
(Please reply to the newsgroups only.)
"Sam" <focus10@.zahav.net.il> wrote in message
news:uBSEB%23urFHA.1168@.TK2MSFTNGP11.phx.gbl...
> so how can i rename the temp table?
>
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:OziOz4urFHA.240@.tk2msftngp13.phx.gbl...
>|||sp_rename renames the table in the current database. a temp table is created
in tempdb database and tempdb doesnt have sp_rename stored procedure.
the table gets deleted immediately after the session is closed, so why do u
want to
rename it
best Regards,
Chandra
http://chanduas.blogspot.com/
http://www.SQLResource.com/
---
"Sam" wrote:

> EXEC sp_rename '#customers', '#custs'
> result with error :Invalid object name '#customers'.
> how to rename a temp table?
>
>
>|||Hi, Dan
That was exactly may point.
"Dan Guzman" <guzmanda@.nospam-online.sbcglobal.net> wrote in message
news:OpFv7%23urFHA.2540@.TK2MSFTNGP09.phx.gbl...
> Uri, I believe sp_rename disallows renaming temp objects.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:OziOz4urFHA.240@.tk2msftngp13.phx.gbl...
>|||> how to rename a temp table?
What would be the point?

Wednesday, March 28, 2012

how to remove login that was dbo of an object

I saw a login that was in the sysadmin role and shouldn't have been. When I
went to the database access tab under properties for the login, each database
had "dbo" in the user column. I couldn't change it so I removed the login and
added him back.
After being sure the login had only datareader rights, when I tried to save
the new login I got an error "the login already has an account under a
different user name". When I clicked ok I got an error "Cannot drop the
database owner". I'm in a loop and can't get out of EM.
How do I fix it?
Thanks,
--
Dan D.Hi Dan
Please read about logins and users in the Books Online. It seems you have
some confusion about those topics.
Per your subject, there is no such thing as the 'dbo of an object'.
DBO is a user name that exists in every database and can not be removed. Any
one who is in the sysadmin role uses the user name dbo in every database.
There will also be some login name who is the true owner of the database,
and that person also will use the user name dbo.
When you are trying to add this login back, what user name are you giving
him?
To see what databases this login has access to, use Query Analyzer (not EM)
and run sp_helplogin for this login. Let us know what you get back.
--
HTH
Kalen Delaney, SQL Server MVP
www.solidqualitylearning.com
"Dan D." <DanD@.discussions.microsoft.com> wrote in message
news:43BC627A-17C5-4E0F-B284-8135FFDB8279@.microsoft.com...
>I saw a login that was in the sysadmin role and shouldn't have been. When I
> went to the database access tab under properties for the login, each
> database
> had "dbo" in the user column. I couldn't change it so I removed the login
> and
> added him back.
> After being sure the login had only datareader rights, when I tried to
> save
> the new login I got an error "the login already has an account under a
> different user name". When I clicked ok I got an error "Cannot drop the
> database owner". I'm in a loop and can't get out of EM.
> How do I fix it?
> Thanks,
> --
> Dan D.
>|||This is what I get using sp_helplogins. I'm trying to add back the
'archer\jvanhoy' login which is the same one that I removed. Do you think
using sp_changedbowner to change the databases to a different login will help?
ARCHER\jvanhoy 0x010500000000000515000000FCE3153178006D1F43170A328E0E0000 bathworld us_english yes no
ARCHER\jvanhoy bathworld db_owner MemberOf
ARCHER\jvanhoy bathworld dbo User
ARCHER\jvanhoy insideMemphis db_owner MemberOf
ARCHER\jvanhoy insideMemphis dbo User
ARCHER\jvanhoy interactivePortfolio db_owner MemberOf
ARCHER\jvanhoy interactivePortfolio dbo User
ARCHER\jvanhoy jpvMemZoo db_owner MemberOf
ARCHER\jvanhoy jpvMemZoo dbo User
ARCHER\jvanhoy leadershipAcad db_owner MemberOf
ARCHER\jvanhoy leadershipAcad dbo User
ARCHER\jvanhoy mmPRToolkit db_owner MemberOf
ARCHER\jvanhoy mmPRToolkit dbo User
ARCHER\jvanhoy rdc db_owner MemberOf
ARCHER\jvanhoy rdc dbo User
ARCHER\jvanhoy rio30 db_owner MemberOf
ARCHER\jvanhoy rio30 dbo User
ARCHER\jvanhoy saigon db_owner MemberOf
ARCHER\jvanhoy saigon dbo User
ARCHER\jvanhoy tellMerryMaids db_owner MemberOf
ARCHER\jvanhoy tellMerryMaids dbo User
ARCHER\jvanhoy tellMerryMaids04 db_owner MemberOf
ARCHER\jvanhoy tellMerryMaids04 dbo User
ARCHER\jvanhoy tempZoo db_owner MemberOf
ARCHER\jvanhoy tempZoo dbo User
ARCHER\jvanhoy testZone db_owner MemberOf
ARCHER\jvanhoy testZone dbo User
ARCHER\jvanhoy tmx_BugsEvite db_owner MemberOf
ARCHER\jvanhoy tmx_BugsEvite dbo User
ARCHER\jvanhoy todaysspas db_owner MemberOf
ARCHER\jvanhoy todaysspas dbo User
ARCHER\jvanhoy valentDeepGreen db_owner MemberOf
ARCHER\jvanhoy valentDeepGreen dbo User
Thanks,
--
Dan D.
"Kalen Delaney" wrote:
> Hi Dan
> Please read about logins and users in the Books Online. It seems you have
> some confusion about those topics.
> Per your subject, there is no such thing as the 'dbo of an object'.
> DBO is a user name that exists in every database and can not be removed. Any
> one who is in the sysadmin role uses the user name dbo in every database.
> There will also be some login name who is the true owner of the database,
> and that person also will use the user name dbo.
> When you are trying to add this login back, what user name are you giving
> him?
> To see what databases this login has access to, use Query Analyzer (not EM)
> and run sp_helplogin for this login. Let us know what you get back.
> --
> HTH
> Kalen Delaney, SQL Server MVP
> www.solidqualitylearning.com
>
> "Dan D." <DanD@.discussions.microsoft.com> wrote in message
> news:43BC627A-17C5-4E0F-B284-8135FFDB8279@.microsoft.com...
> >I saw a login that was in the sysadmin role and shouldn't have been. When I
> > went to the database access tab under properties for the login, each
> > database
> > had "dbo" in the user column. I couldn't change it so I removed the login
> > and
> > added him back.
> >
> > After being sure the login had only datareader rights, when I tried to
> > save
> > the new login I got an error "the login already has an account under a
> > different user name". When I clicked ok I got an error "Cannot drop the
> > database owner". I'm in a loop and can't get out of EM.
> >
> > How do I fix it?
> >
> > Thanks,
> > --
> > Dan D.
> >
>
>|||Is this user actually the owner of all these databases? sp_helpdb can
confirm.
What is your goal? I can't tell you if changing the owner would 'help' if I
don't know what you are hoping to get.
--
HTH
Kalen Delaney, SQL Server MVP
www.solidqualitylearning.com
"Dan D." <DanD@.discussions.microsoft.com> wrote in message
news:B7A644AB-83D5-4C3F-B498-7BAC01693F0E@.microsoft.com...
> This is what I get using sp_helplogins. I'm trying to add back the
> 'archer\jvanhoy' login which is the same one that I removed. Do you think
> using sp_changedbowner to change the databases to a different login will
> help?
> ARCHER\jvanhoy 0x010500000000000515000000FCE3153178006D1F43170A328E0E0000
> bathworld us_english yes no
> ARCHER\jvanhoy bathworld db_owner MemberOf
> ARCHER\jvanhoy bathworld dbo User
> ARCHER\jvanhoy insideMemphis db_owner MemberOf
> ARCHER\jvanhoy insideMemphis dbo User
> ARCHER\jvanhoy interactivePortfolio db_owner MemberOf
> ARCHER\jvanhoy interactivePortfolio dbo User
> ARCHER\jvanhoy jpvMemZoo db_owner MemberOf
> ARCHER\jvanhoy jpvMemZoo dbo User
> ARCHER\jvanhoy leadershipAcad db_owner MemberOf
> ARCHER\jvanhoy leadershipAcad dbo User
> ARCHER\jvanhoy mmPRToolkit db_owner MemberOf
> ARCHER\jvanhoy mmPRToolkit dbo User
> ARCHER\jvanhoy rdc db_owner MemberOf
> ARCHER\jvanhoy rdc dbo User
> ARCHER\jvanhoy rio30 db_owner MemberOf
> ARCHER\jvanhoy rio30 dbo User
> ARCHER\jvanhoy saigon db_owner MemberOf
> ARCHER\jvanhoy saigon dbo User
> ARCHER\jvanhoy tellMerryMaids db_owner MemberOf
> ARCHER\jvanhoy tellMerryMaids dbo User
> ARCHER\jvanhoy tellMerryMaids04 db_owner MemberOf
> ARCHER\jvanhoy tellMerryMaids04 dbo User
> ARCHER\jvanhoy tempZoo db_owner MemberOf
> ARCHER\jvanhoy tempZoo dbo User
> ARCHER\jvanhoy testZone db_owner MemberOf
> ARCHER\jvanhoy testZone dbo User
> ARCHER\jvanhoy tmx_BugsEvite db_owner MemberOf
> ARCHER\jvanhoy tmx_BugsEvite dbo User
> ARCHER\jvanhoy todaysspas db_owner MemberOf
> ARCHER\jvanhoy todaysspas dbo User
> ARCHER\jvanhoy valentDeepGreen db_owner MemberOf
> ARCHER\jvanhoy valentDeepGreen dbo User
> Thanks,
> --
> Dan D.
>
> "Kalen Delaney" wrote:
>> Hi Dan
>> Please read about logins and users in the Books Online. It seems you have
>> some confusion about those topics.
>> Per your subject, there is no such thing as the 'dbo of an object'.
>> DBO is a user name that exists in every database and can not be removed.
>> Any
>> one who is in the sysadmin role uses the user name dbo in every database.
>> There will also be some login name who is the true owner of the database,
>> and that person also will use the user name dbo.
>> When you are trying to add this login back, what user name are you giving
>> him?
>> To see what databases this login has access to, use Query Analyzer (not
>> EM)
>> and run sp_helplogin for this login. Let us know what you get back.
>> --
>> HTH
>> Kalen Delaney, SQL Server MVP
>> www.solidqualitylearning.com
>>
>> "Dan D." <DanD@.discussions.microsoft.com> wrote in message
>> news:43BC627A-17C5-4E0F-B284-8135FFDB8279@.microsoft.com...
>> >I saw a login that was in the sysadmin role and shouldn't have been.
>> >When I
>> > went to the database access tab under properties for the login, each
>> > database
>> > had "dbo" in the user column. I couldn't change it so I removed the
>> > login
>> > and
>> > added him back.
>> >
>> > After being sure the login had only datareader rights, when I tried to
>> > save
>> > the new login I got an error "the login already has an account under a
>> > different user name". When I clicked ok I got an error "Cannot drop the
>> > database owner". I'm in a loop and can't get out of EM.
>> >
>> > How do I fix it?
>> >
>> > Thanks,
>> > --
>> > Dan D.
>> >
>>
>>
>|||This login should only have read permissions or read and write permissions to
all databases. Someone gave the login sysadmin permissions.
I used sp_changedbowner on all of the databases then I was able to save the
new login with read only permissions to the databases.
Thanks for your help.
--
Dan D.
"Kalen Delaney" wrote:
> Is this user actually the owner of all these databases? sp_helpdb can
> confirm.
> What is your goal? I can't tell you if changing the owner would 'help' if I
> don't know what you are hoping to get.
> --
> HTH
> Kalen Delaney, SQL Server MVP
> www.solidqualitylearning.com
>
> "Dan D." <DanD@.discussions.microsoft.com> wrote in message
> news:B7A644AB-83D5-4C3F-B498-7BAC01693F0E@.microsoft.com...
> > This is what I get using sp_helplogins. I'm trying to add back the
> > 'archer\jvanhoy' login which is the same one that I removed. Do you think
> > using sp_changedbowner to change the databases to a different login will
> > help?
> >
> > ARCHER\jvanhoy 0x010500000000000515000000FCE3153178006D1F43170A328E0E0000
> > bathworld us_english yes no
> > ARCHER\jvanhoy bathworld db_owner MemberOf
> > ARCHER\jvanhoy bathworld dbo User
> > ARCHER\jvanhoy insideMemphis db_owner MemberOf
> > ARCHER\jvanhoy insideMemphis dbo User
> > ARCHER\jvanhoy interactivePortfolio db_owner MemberOf
> > ARCHER\jvanhoy interactivePortfolio dbo User
> > ARCHER\jvanhoy jpvMemZoo db_owner MemberOf
> > ARCHER\jvanhoy jpvMemZoo dbo User
> > ARCHER\jvanhoy leadershipAcad db_owner MemberOf
> > ARCHER\jvanhoy leadershipAcad dbo User
> > ARCHER\jvanhoy mmPRToolkit db_owner MemberOf
> > ARCHER\jvanhoy mmPRToolkit dbo User
> > ARCHER\jvanhoy rdc db_owner MemberOf
> > ARCHER\jvanhoy rdc dbo User
> > ARCHER\jvanhoy rio30 db_owner MemberOf
> > ARCHER\jvanhoy rio30 dbo User
> > ARCHER\jvanhoy saigon db_owner MemberOf
> > ARCHER\jvanhoy saigon dbo User
> > ARCHER\jvanhoy tellMerryMaids db_owner MemberOf
> > ARCHER\jvanhoy tellMerryMaids dbo User
> > ARCHER\jvanhoy tellMerryMaids04 db_owner MemberOf
> > ARCHER\jvanhoy tellMerryMaids04 dbo User
> > ARCHER\jvanhoy tempZoo db_owner MemberOf
> > ARCHER\jvanhoy tempZoo dbo User
> > ARCHER\jvanhoy testZone db_owner MemberOf
> > ARCHER\jvanhoy testZone dbo User
> > ARCHER\jvanhoy tmx_BugsEvite db_owner MemberOf
> > ARCHER\jvanhoy tmx_BugsEvite dbo User
> > ARCHER\jvanhoy todaysspas db_owner MemberOf
> > ARCHER\jvanhoy todaysspas dbo User
> > ARCHER\jvanhoy valentDeepGreen db_owner MemberOf
> > ARCHER\jvanhoy valentDeepGreen dbo User
> >
> > Thanks,
> > --
> > Dan D.
> >
> >
> > "Kalen Delaney" wrote:
> >
> >>
> >> Hi Dan
> >>
> >> Please read about logins and users in the Books Online. It seems you have
> >> some confusion about those topics.
> >> Per your subject, there is no such thing as the 'dbo of an object'.
> >>
> >> DBO is a user name that exists in every database and can not be removed.
> >> Any
> >> one who is in the sysadmin role uses the user name dbo in every database.
> >> There will also be some login name who is the true owner of the database,
> >> and that person also will use the user name dbo.
> >>
> >> When you are trying to add this login back, what user name are you giving
> >> him?
> >>
> >> To see what databases this login has access to, use Query Analyzer (not
> >> EM)
> >> and run sp_helplogin for this login. Let us know what you get back.
> >>
> >> --
> >> HTH
> >> Kalen Delaney, SQL Server MVP
> >> www.solidqualitylearning.com
> >>
> >>
> >> "Dan D." <DanD@.discussions.microsoft.com> wrote in message
> >> news:43BC627A-17C5-4E0F-B284-8135FFDB8279@.microsoft.com...
> >> >I saw a login that was in the sysadmin role and shouldn't have been.
> >> >When I
> >> > went to the database access tab under properties for the login, each
> >> > database
> >> > had "dbo" in the user column. I couldn't change it so I removed the
> >> > login
> >> > and
> >> > added him back.
> >> >
> >> > After being sure the login had only datareader rights, when I tried to
> >> > save
> >> > the new login I got an error "the login already has an account under a
> >> > different user name". When I clicked ok I got an error "Cannot drop the
> >> > database owner". I'm in a loop and can't get out of EM.
> >> >
> >> > How do I fix it?
> >> >
> >> > Thanks,
> >> > --
> >> > Dan D.
> >> >
> >>
> >>
> >>
> >>
> >
>
>

how to remove login that was dbo of an object

I saw a login that was in the sysadmin role and shouldn't have been. When I
went to the database access tab under properties for the login, each databas
e
had "dbo" in the user column. I couldn't change it so I removed the login an
d
added him back.
After being sure the login had only datareader rights, when I tried to save
the new login I got an error "the login already has an account under a
different user name". When I clicked ok I got an error "Cannot drop the
database owner". I'm in a loop and can't get out of EM.
How do I fix it?
Thanks,
--
Dan D.Hi Dan
Please read about logins and users in the Books Online. It seems you have
some confusion about those topics.
Per your subject, there is no such thing as the 'dbo of an object'.
DBO is a user name that exists in every database and can not be removed. Any
one who is in the sysadmin role uses the user name dbo in every database.
There will also be some login name who is the true owner of the database,
and that person also will use the user name dbo.
When you are trying to add this login back, what user name are you giving
him?
To see what databases this login has access to, use Query Analyzer (not EM)
and run sp_helplogin for this login. Let us know what you get back.
HTH
Kalen Delaney, SQL Server MVP
www.solidqualitylearning.com
"Dan D." <DanD@.discussions.microsoft.com> wrote in message
news:43BC627A-17C5-4E0F-B284-8135FFDB8279@.microsoft.com...
>I saw a login that was in the sysadmin role and shouldn't have been. When I
> went to the database access tab under properties for the login, each
> database
> had "dbo" in the user column. I couldn't change it so I removed the login
> and
> added him back.
> After being sure the login had only datareader rights, when I tried to
> save
> the new login I got an error "the login already has an account under a
> different user name". When I clicked ok I got an error "Cannot drop the
> database owner". I'm in a loop and can't get out of EM.
> How do I fix it?
> Thanks,
> --
> Dan D.
>|||This is what I get using sp_helplogins. I'm trying to add back the
'archer\jvanhoy' login which is the same one that I removed. Do you think
using sp_changedbowner to change the databases to a different login will hel
p?
ARCHER\jvanhoy 0x01050000000000051500000
0FCE3153178006D1F43170A328E0E0000 ba
thworld us_english yes no
ARCHER\jvanhoy bathworld db_owner Member
Of
ARCHER\jvanhoy bathworld dbo User
ARCHER\jvanhoy insideMemphis db_owner Me
mberOf
ARCHER\jvanhoy insideMemphis dbo User
ARCHER\jvanhoy interactivePortfolio db_o
wner MemberOf
ARCHER\jvanhoy interactivePortfolio dbo
User
ARCHER\jvanhoy jpvMemZoo db_owner Member
Of
ARCHER\jvanhoy jpvMemZoo dbo User
ARCHER\jvanhoy leadershipAcad db_owner M
emberOf
ARCHER\jvanhoy leadershipAcad dbo User
ARCHER\jvanhoy mmPRToolkit db_owner Memb
erOf
ARCHER\jvanhoy mmPRToolkit dbo User
ARCHER\jvanhoy rdc db_owner MemberOf
ARCHER\jvanhoy rdc dbo User
ARCHER\jvanhoy rio30 db_owner MemberOf
ARCHER\jvanhoy rio30 dbo User
ARCHER\jvanhoy saigon db_owner MemberOf
ARCHER\jvanhoy saigon dbo User
ARCHER\jvanhoy tellMerryMaids db_owner M
emberOf
ARCHER\jvanhoy tellMerryMaids dbo User
ARCHER\jvanhoy tellMerryMaids04 db_owner
MemberOf
ARCHER\jvanhoy tellMerryMaids04 dbo User
ARCHER\jvanhoy tempZoo db_owner MemberOf
ARCHER\jvanhoy tempZoo dbo User
ARCHER\jvanhoy testZone db_owner MemberO
f
ARCHER\jvanhoy testZone dbo User
ARCHER\jvanhoy tmx_BugsEvite db_owner Me
mberOf
ARCHER\jvanhoy tmx_BugsEvite dbo User
ARCHER\jvanhoy todaysspas db_owner Membe
rOf
ARCHER\jvanhoy todaysspas dbo User
ARCHER\jvanhoy valentDeepGreen db_owner
MemberOf
ARCHER\jvanhoy valentDeepGreen dbo User
Thanks,
--
Dan D.
"Kalen Delaney" wrote:

> Hi Dan
> Please read about logins and users in the Books Online. It seems you have
> some confusion about those topics.
> Per your subject, there is no such thing as the 'dbo of an object'.
> DBO is a user name that exists in every database and can not be removed. A
ny
> one who is in the sysadmin role uses the user name dbo in every database.
> There will also be some login name who is the true owner of the database,
> and that person also will use the user name dbo.
> When you are trying to add this login back, what user name are you giving
> him?
> To see what databases this login has access to, use Query Analyzer (not EM
)
> and run sp_helplogin for this login. Let us know what you get back.
> --
> HTH
> Kalen Delaney, SQL Server MVP
> www.solidqualitylearning.com
>
> "Dan D." <DanD@.discussions.microsoft.com> wrote in message
> news:43BC627A-17C5-4E0F-B284-8135FFDB8279@.microsoft.com...
>
>|||Is this user actually the owner of all these databases? sp_helpdb can
confirm.
What is your goal? I can't tell you if changing the owner would 'help' if I
don't know what you are hoping to get.
HTH
Kalen Delaney, SQL Server MVP
www.solidqualitylearning.com
"Dan D." <DanD@.discussions.microsoft.com> wrote in message
news:B7A644AB-83D5-4C3F-B498-7BAC01693F0E@.microsoft.com...
> This is what I get using sp_helplogins. I'm trying to add back the
> 'archer\jvanhoy' login which is the same one that I removed. Do you think
> using sp_changedbowner to change the databases to a different login will
> help?
> ARCHER\jvanhoy 0x010500000000000515000000FCE3153178006D
1F43170A328E0E0000
> bathworld us_english yes no
> ARCHER\jvanhoy bathworld db_owner MemberOf
> ARCHER\jvanhoy bathworld dbo User
> ARCHER\jvanhoy insideMemphis db_owner MemberOf
> ARCHER\jvanhoy insideMemphis dbo User
> ARCHER\jvanhoy interactivePortfolio db_owner MemberOf
> ARCHER\jvanhoy interactivePortfolio dbo User
> ARCHER\jvanhoy jpvMemZoo db_owner MemberOf
> ARCHER\jvanhoy jpvMemZoo dbo User
> ARCHER\jvanhoy leadershipAcad db_owner MemberOf
> ARCHER\jvanhoy leadershipAcad dbo User
> ARCHER\jvanhoy mmPRToolkit db_owner MemberOf
> ARCHER\jvanhoy mmPRToolkit dbo User
> ARCHER\jvanhoy rdc db_owner MemberOf
> ARCHER\jvanhoy rdc dbo User
> ARCHER\jvanhoy rio30 db_owner MemberOf
> ARCHER\jvanhoy rio30 dbo User
> ARCHER\jvanhoy saigon db_owner MemberOf
> ARCHER\jvanhoy saigon dbo User
> ARCHER\jvanhoy tellMerryMaids db_owner MemberOf
> ARCHER\jvanhoy tellMerryMaids dbo User
> ARCHER\jvanhoy tellMerryMaids04 db_owner MemberOf
> ARCHER\jvanhoy tellMerryMaids04 dbo User
> ARCHER\jvanhoy tempZoo db_owner MemberOf
> ARCHER\jvanhoy tempZoo dbo User
> ARCHER\jvanhoy testZone db_owner MemberOf
> ARCHER\jvanhoy testZone dbo User
> ARCHER\jvanhoy tmx_BugsEvite db_owner MemberOf
> ARCHER\jvanhoy tmx_BugsEvite dbo User
> ARCHER\jvanhoy todaysspas db_owner MemberOf
> ARCHER\jvanhoy todaysspas dbo User
> ARCHER\jvanhoy valentDeepGreen db_owner MemberOf
> ARCHER\jvanhoy valentDeepGreen dbo User
> Thanks,
> --
> Dan D.
>
> "Kalen Delaney" wrote:
>
>|||This login should only have read permissions or read and write permissions t
o
all databases. Someone gave the login sysadmin permissions.
I used sp_changedbowner on all of the databases then I was able to save the
new login with read only permissions to the databases.
Thanks for your help.
--
Dan D.
"Kalen Delaney" wrote:

> Is this user actually the owner of all these databases? sp_helpdb can
> confirm.
> What is your goal? I can't tell you if changing the owner would 'help' if
I
> don't know what you are hoping to get.
> --
> HTH
> Kalen Delaney, SQL Server MVP
> www.solidqualitylearning.com
>
> "Dan D." <DanD@.discussions.microsoft.com> wrote in message
> news:B7A644AB-83D5-4C3F-B498-7BAC01693F0E@.microsoft.com...
>
>

how to remove login that was dbo of an object

I saw a login that was in the sysadmin role and shouldn't have been. When I
went to the database access tab under properties for the login, each database
had "dbo" in the user column. I couldn't change it so I removed the login and
added him back.
After being sure the login had only datareader rights, when I tried to save
the new login I got an error "the login already has an account under a
different user name". When I clicked ok I got an error "Cannot drop the
database owner". I'm in a loop and can't get out of EM.
How do I fix it?
Thanks,
Dan D.
Hi Dan
Please read about logins and users in the Books Online. It seems you have
some confusion about those topics.
Per your subject, there is no such thing as the 'dbo of an object'.
DBO is a user name that exists in every database and can not be removed. Any
one who is in the sysadmin role uses the user name dbo in every database.
There will also be some login name who is the true owner of the database,
and that person also will use the user name dbo.
When you are trying to add this login back, what user name are you giving
him?
To see what databases this login has access to, use Query Analyzer (not EM)
and run sp_helplogin for this login. Let us know what you get back.
HTH
Kalen Delaney, SQL Server MVP
www.solidqualitylearning.com
"Dan D." <DanD@.discussions.microsoft.com> wrote in message
news:43BC627A-17C5-4E0F-B284-8135FFDB8279@.microsoft.com...
>I saw a login that was in the sysadmin role and shouldn't have been. When I
> went to the database access tab under properties for the login, each
> database
> had "dbo" in the user column. I couldn't change it so I removed the login
> and
> added him back.
> After being sure the login had only datareader rights, when I tried to
> save
> the new login I got an error "the login already has an account under a
> different user name". When I clicked ok I got an error "Cannot drop the
> database owner". I'm in a loop and can't get out of EM.
> How do I fix it?
> Thanks,
> --
> Dan D.
>
|||This is what I get using sp_helplogins. I'm trying to add back the
'archer\jvanhoy' login which is the same one that I removed. Do you think
using sp_changedbowner to change the databases to a different login will help?
ARCHER\jvanhoy0x010500000000000515000000FCE3153178006D1F43170A32 8E0E0000bathworldus_englishyes no
ARCHER\jvanhoybathworlddb_ownerMemberOf
ARCHER\jvanhoybathworlddboUser
ARCHER\jvanhoyinsideMemphisdb_ownerMemberOf
ARCHER\jvanhoyinsideMemphisdboUser
ARCHER\jvanhoyinteractivePortfoliodb_ownerMemberOf
ARCHER\jvanhoyinteractivePortfoliodboUser
ARCHER\jvanhoyjpvMemZoodb_ownerMemberOf
ARCHER\jvanhoyjpvMemZoodboUser
ARCHER\jvanhoyleadershipAcaddb_ownerMemberOf
ARCHER\jvanhoyleadershipAcaddboUser
ARCHER\jvanhoymmPRToolkitdb_ownerMemberOf
ARCHER\jvanhoymmPRToolkitdboUser
ARCHER\jvanhoyrdcdb_ownerMemberOf
ARCHER\jvanhoyrdcdboUser
ARCHER\jvanhoyrio30db_ownerMemberOf
ARCHER\jvanhoyrio30dboUser
ARCHER\jvanhoysaigondb_ownerMemberOf
ARCHER\jvanhoysaigondboUser
ARCHER\jvanhoytellMerryMaidsdb_ownerMemberOf
ARCHER\jvanhoytellMerryMaidsdboUser
ARCHER\jvanhoytellMerryMaids04db_ownerMemberOf
ARCHER\jvanhoytellMerryMaids04dboUser
ARCHER\jvanhoytempZoodb_ownerMemberOf
ARCHER\jvanhoytempZoodboUser
ARCHER\jvanhoytestZonedb_ownerMemberOf
ARCHER\jvanhoytestZonedboUser
ARCHER\jvanhoytmx_BugsEvitedb_ownerMemberOf
ARCHER\jvanhoytmx_BugsEvitedboUser
ARCHER\jvanhoytodaysspasdb_ownerMemberOf
ARCHER\jvanhoytodaysspasdboUser
ARCHER\jvanhoyvalentDeepGreendb_ownerMemberOf
ARCHER\jvanhoyvalentDeepGreendboUser
Thanks,
Dan D.
"Kalen Delaney" wrote:

> Hi Dan
> Please read about logins and users in the Books Online. It seems you have
> some confusion about those topics.
> Per your subject, there is no such thing as the 'dbo of an object'.
> DBO is a user name that exists in every database and can not be removed. Any
> one who is in the sysadmin role uses the user name dbo in every database.
> There will also be some login name who is the true owner of the database,
> and that person also will use the user name dbo.
> When you are trying to add this login back, what user name are you giving
> him?
> To see what databases this login has access to, use Query Analyzer (not EM)
> and run sp_helplogin for this login. Let us know what you get back.
> --
> HTH
> Kalen Delaney, SQL Server MVP
> www.solidqualitylearning.com
>
> "Dan D." <DanD@.discussions.microsoft.com> wrote in message
> news:43BC627A-17C5-4E0F-B284-8135FFDB8279@.microsoft.com...
>
>
|||Is this user actually the owner of all these databases? sp_helpdb can
confirm.
What is your goal? I can't tell you if changing the owner would 'help' if I
don't know what you are hoping to get.
HTH
Kalen Delaney, SQL Server MVP
www.solidqualitylearning.com
"Dan D." <DanD@.discussions.microsoft.com> wrote in message
news:B7A644AB-83D5-4C3F-B498-7BAC01693F0E@.microsoft.com...
> This is what I get using sp_helplogins. I'm trying to add back the
> 'archer\jvanhoy' login which is the same one that I removed. Do you think
> using sp_changedbowner to change the databases to a different login will
> help?
> ARCHER\jvanhoy 0x010500000000000515000000FCE3153178006D1F43170A32 8E0E0000
> bathworld us_english yes no
> ARCHER\jvanhoy bathworld db_owner MemberOf
> ARCHER\jvanhoy bathworld dbo User
> ARCHER\jvanhoy insideMemphis db_owner MemberOf
> ARCHER\jvanhoy insideMemphis dbo User
> ARCHER\jvanhoy interactivePortfolio db_owner MemberOf
> ARCHER\jvanhoy interactivePortfolio dbo User
> ARCHER\jvanhoy jpvMemZoo db_owner MemberOf
> ARCHER\jvanhoy jpvMemZoo dbo User
> ARCHER\jvanhoy leadershipAcad db_owner MemberOf
> ARCHER\jvanhoy leadershipAcad dbo User
> ARCHER\jvanhoy mmPRToolkit db_owner MemberOf
> ARCHER\jvanhoy mmPRToolkit dbo User
> ARCHER\jvanhoy rdc db_owner MemberOf
> ARCHER\jvanhoy rdc dbo User
> ARCHER\jvanhoy rio30 db_owner MemberOf
> ARCHER\jvanhoy rio30 dbo User
> ARCHER\jvanhoy saigon db_owner MemberOf
> ARCHER\jvanhoy saigon dbo User
> ARCHER\jvanhoy tellMerryMaids db_owner MemberOf
> ARCHER\jvanhoy tellMerryMaids dbo User
> ARCHER\jvanhoy tellMerryMaids04 db_owner MemberOf
> ARCHER\jvanhoy tellMerryMaids04 dbo User
> ARCHER\jvanhoy tempZoo db_owner MemberOf
> ARCHER\jvanhoy tempZoo dbo User
> ARCHER\jvanhoy testZone db_owner MemberOf
> ARCHER\jvanhoy testZone dbo User
> ARCHER\jvanhoy tmx_BugsEvite db_owner MemberOf
> ARCHER\jvanhoy tmx_BugsEvite dbo User
> ARCHER\jvanhoy todaysspas db_owner MemberOf
> ARCHER\jvanhoy todaysspas dbo User
> ARCHER\jvanhoy valentDeepGreen db_owner MemberOf
> ARCHER\jvanhoy valentDeepGreen dbo User
> Thanks,
> --
> Dan D.
>
> "Kalen Delaney" wrote:
>
|||This login should only have read permissions or read and write permissions to
all databases. Someone gave the login sysadmin permissions.
I used sp_changedbowner on all of the databases then I was able to save the
new login with read only permissions to the databases.
Thanks for your help.
Dan D.
"Kalen Delaney" wrote:

> Is this user actually the owner of all these databases? sp_helpdb can
> confirm.
> What is your goal? I can't tell you if changing the owner would 'help' if I
> don't know what you are hoping to get.
> --
> HTH
> Kalen Delaney, SQL Server MVP
> www.solidqualitylearning.com
>
> "Dan D." <DanD@.discussions.microsoft.com> wrote in message
> news:B7A644AB-83D5-4C3F-B498-7BAC01693F0E@.microsoft.com...
>
>

Wednesday, March 21, 2012

How to reduce white space when object is hidden?

The report is made of one list containing 2 tables, one below each other.
Depending on the report parameters, the bottom table is made visible or
hidden.
When that table is hidden at run time, RS still reserves the same amount of
white space that the table takes in the report design layout.
This causes RS to render an extra white page at the end of the report where
it would display the table. Since the table is hidden, nothing is displayed
in this extra white page.
Does anyone know a workaround that would prevent the white page at the end
of the report?Hi Pat,
Thanks for your post.
From your descriptions, I understood the report will reserve some the
space for that hidden table when there is two tables in the Report. If I
have misunderstood your concern, please feel free to point it out.
I have tested on my side but it seems RS won't reserve the place for hidden
objects. Would you please show me a sample with AdventureWorks, with which
I could reproduce it on my side?
Sincerely yours,
Michael Cheng
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================
This posting is provided "AS IS" with no warranties, and confers no rights.|||Did you try the scenario where both table are contained in one list?
"Michael Cheng [MSFT]" wrote:
> Hi Pat,
> Thanks for your post.
> From your descriptions, I understood the report will reserve some the
> space for that hidden table when there is two tables in the Report. If I
> have misunderstood your concern, please feel free to point it out.
> I have tested on my side but it seems RS won't reserve the place for hidden
> objects. Would you please show me a sample with AdventureWorks, with which
> I could reproduce it on my side?
>
> Sincerely yours,
> Michael Cheng
> Microsoft Online Partner Support
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> =====================================================> This posting is provided "AS IS" with no warranties, and confers no rights.
>|||Hi Pat,
Thanks for your patience.
If you set the visibility like this:
<Visibility>
<Hidden>true</Hidden>
</Visibility>
This means that the table is always hidden. The space is preserved for
always hidden items. If you changed visibility according to Expression, it
will not reduce the white space.
However, I have tested the scenario that both table are contained in one
list as you described. It will do leave the blank and I am afraid currently
we cannot eliminate this behavior.
Sincerely yours,
Michael Cheng
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Wednesday, March 7, 2012

How to raise error in script

I can't believe I can't find this in books online...

I have a transformation script component and I have a case where I want the object to completely fail if it is encountered. How do I code that? All my searching BOL could find is how to redirect rows to an error output which is not what I need in this case.... I'd think it would be something simple like Me.RaiseError("Something really bad happened") but I haven't found it ...

Chris,

A simple example from books online to raise an error in the Script Component is:

Dim myMetadata as IDTSComponentMetaData90

myMetaData = Me.ComponentMetaData

myMetaData.FireError(...)

Further details can be found on the Raising Events in the Script Component page at: http://msdn2.microsoft.com/en-us/library/aa337081.aspx.

Thanks,
Patrik

|||Thanks... I knew it it had to be in books online somewhere.. I just couldn't find it |||

One thing to note that I have found with this method is that it doesn't immediately error..

For example lets say you have a buffer (in a dataflow) containing 1000 rows. In my experience, if you code a FireError when it encounters null it will not exit the object on the first instance but continue with the whole buffer - then your dtslog will be filled with 1000 errors (if indeed each row of the 1000 had a null). Just something to keep in mind.

|||

Throw an exception to simulate the Fail Component disposition. This action will cause the transformation script component to immediately fail.

ComponentMetadata's FireError, as you noted, will not cause immediate failure, but rather, form a basis for comparison with the data flow's MaximumErrorCount (which may be useful in other cases)

|||

"Throw an exception to simulate the Fail Component disposition. This action will cause the transformation script component to immediately fail."

Thanks, Can you provide an example or a pointer to where to look in books online?

|||

From BOL, please use the following example.

Using Error Outputs in a Data Flow Component

ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/dtsref9/html/a2a3e7c8-1de2-45b3-97fb-60415d3b0934.htm

First off, to establish the relevance of the above BOL link related to data flow component error outputs, recall that a script component (actually a script component host) is just another type of custom pipeline component. A ScriptComponentHost derives from PipelineComponent. PipelineComponent is the base class used when writing pipeline components. The ScriptComponentHost provides services to the auto-generated classes known as the "Script Component".

Anyway, in the BOL reference example, the FailComponent disposition is emulated by throwing an exception. Furthermore, Kirk Haselden, who I consider an authority on the subject of SSIS, states something similar in https://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=601735&SiteID=1.

As far as script component example, say, for the sake of a simple example, you are adding non-negative numbers, the sum of which cannot exceeed 42. At some point, the sum exceeds 42. You can keep adding and calling Dts.FireError() repeatedly, indicating the sum is logically impossible in your event message. Instead, to immediately fail the component, the solution is to call Dts.FireError() once with the appropriate error message, and then throw an exception to fail the component.

|||

Thanks jaegd for the above.

I have followed your advice of the FireError() then 'throw new exception'

However if one has an OnError event (as I do) to send an email of the error description, then no less 4 messages are sent:

1. The FireError error

2. A result of the exception -"System.Exception"

3 A result of the exception "The ProcessInput method on component: " (something to do with a lookup transform up-line)

4.Another result of the exception "Thread "WorkThread0" has exited with error code 0x"

So how does one allow the FireError OnError to execute but suppress the other spurious events?

Thanks

|||Put a test in front of your email task to decide what gets sent. Then the recipient receives a single email from an error event cascade.

For one, suppress the errors 3 ("The process InputMethod on component"), and 4 ("Thread "WorkThread0" has exited...) via an expression based precedence constraint to your Send Mail task. The specific Error Codes are accessible in the handler upon which a suppression decision can be made.

That leaves you with two errors, which are both more relevant to why the data flow was halted. You can dispense with with FireError call, and just use the exception, leaving a single email.|||

Thanks

Of course this is only usefull if you know in advance what the extraneous error messages are going to be in all cases. So I don't consider that to be an elegant solution. If I knew why multiple error messages where generated for only the one error then I might have a chance at obtaining a better solution. Also access to a system variable such as ErrorCount would be usefull too. Nevermind, I'll attack this in a similar manner to what you have suggested (instead of the message I'll go off the error code).

Friday, February 24, 2012

How to raise error in script

I can't believe I can't find this in books online...

I have a transformation script component and I have a case where I want the object to completely fail if it is encountered. How do I code that? All my searching BOL could find is how to redirect rows to an error output which is not what I need in this case.... I'd think it would be something simple like Me.RaiseError("Something really bad happened") but I haven't found it ...

Chris,

A simple example from books online to raise an error in the Script Component is:

Dim myMetadata as IDTSComponentMetaData90

myMetaData = Me.ComponentMetaData

myMetaData.FireError(...)

Further details can be found on the Raising Events in the Script Component page at: http://msdn2.microsoft.com/en-us/library/aa337081.aspx.

Thanks,
Patrik

|||Thanks... I knew it it had to be in books online somewhere.. I just couldn't find it |||

One thing to note that I have found with this method is that it doesn't immediately error..

For example lets say you have a buffer (in a dataflow) containing 1000 rows. In my experience, if you code a FireError when it encounters null it will not exit the object on the first instance but continue with the whole buffer - then your dtslog will be filled with 1000 errors (if indeed each row of the 1000 had a null). Just something to keep in mind.

|||

Throw an exception to simulate the Fail Component disposition. This action will cause the transformation script component to immediately fail.

ComponentMetadata's FireError, as you noted, will not cause immediate failure, but rather, form a basis for comparison with the data flow's MaximumErrorCount (which may be useful in other cases)

|||

"Throw an exception to simulate the Fail Component disposition. This action will cause the transformation script component to immediately fail."

Thanks, Can you provide an example or a pointer to where to look in books online?

|||

From BOL, please use the following example.

Using Error Outputs in a Data Flow Component

ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/dtsref9/html/a2a3e7c8-1de2-45b3-97fb-60415d3b0934.htm

First off, to establish the relevance of the above BOL link related to data flow component error outputs, recall that a script component (actually a script component host) is just another type of custom pipeline component. A ScriptComponentHost derives from PipelineComponent. PipelineComponent is the base class used when writing pipeline components. The ScriptComponentHost provides services to the auto-generated classes known as the "Script Component".

Anyway, in the BOL reference example, the FailComponent disposition is emulated by throwing an exception. Furthermore, Kirk Haselden, who I consider an authority on the subject of SSIS, states something similar in https://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=601735&SiteID=1.

As far as script component example, say, for the sake of a simple example, you are adding non-negative numbers, the sum of which cannot exceeed 42. At some point, the sum exceeds 42. You can keep adding and calling Dts.FireError() repeatedly, indicating the sum is logically impossible in your event message. Instead, to immediately fail the component, the solution is to call Dts.FireError() once with the appropriate error message, and then throw an exception to fail the component.

|||

Thanks jaegd for the above.

I have followed your advice of the FireError() then 'throw new exception'

However if one has an OnError event (as I do) to send an email of the error description, then no less 4 messages are sent:

1. The FireError error

2. A result of the exception -"System.Exception"

3 A result of the exception "The ProcessInput method on component: " (something to do with a lookup transform up-line)

4.Another result of the exception "Thread "WorkThread0" has exited with error code 0x"

So how does one allow the FireError OnError to execute but suppress the other spurious events?

Thanks

|||Put a test in front of your email task to decide what gets sent. Then the recipient receives a single email from an error event cascade.

For one, suppress the errors 3 ("The process InputMethod on component"), and 4 ("Thread "WorkThread0" has exited...) via an expression based precedence constraint to your Send Mail task. The specific Error Codes are accessible in the handler upon which a suppression decision can be made.

That leaves you with two errors, which are both more relevant to why the data flow was halted. You can dispense with with FireError call, and just use the exception, leaving a single email.|||

Thanks

Of course this is only usefull if you know in advance what the extraneous error messages are going to be in all cases. So I don't consider that to be an elegant solution. If I knew why multiple error messages where generated for only the one error then I might have a chance at obtaining a better solution. Also access to a system variable such as ErrorCount would be usefull too. Nevermind, I'll attack this in a similar manner to what you have suggested (instead of the message I'll go off the error code).

Sunday, February 19, 2012

How to query a view from the master DB?

Is there a way to access your views in x database from the master database?

I'm getting this error

Invalid object name 'v_StatisticsScalars'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Invalid object name 'v_StatisticsScalars'.Use the fully qualified path <database>.<owner>.<view
Or you can use "use"|||cant use USE in stored procedures can you?

im using system stored procedures.....and i thought the context stayed at the database calling the system stored procedure? am i wrong?|||i really dont want to use x.y.z because im using these stored procedures for a few different sites. it would be good if i could add the view to the master database. can that be done? i tried....but then it says my tables dont exist. :/ -so now im back at square1|||Now I'm confused too. I understand that you're relucant to use the fully qualified path. I don't understand what you mean by "I'm using system stored procedures". You can create a view to access other database table but we're back to using the fully qualified path again! If the database was on a different server (or server instance) you could setup a linked server. Apart from that I think you're stuck. Well you could construct some dynamic sql and exec that to get around the 'different sites' issue. In fact just have a util prog that generates the procs/views based upon the database names you want to use.