Showing posts with label databases. Show all posts
Showing posts with label databases. Show all posts

Tuesday, March 27, 2012

default DB names for SSRS?

I was wondering if one SQL Server could host more then one set of Reporting Services databases? This would then lead to the question of, can the default names be change to what ever? Say the Accounting and R/D groups wants to use the same SSRS so, we name their databases ACCT_ReportServer and RD_ReportServer, etc..? Can I do this? I believe I can but need to be sure.

thanks much,
joe

can i ask , why you would want to do this? Report Server allows you to set up groups of people who have access to certain reports...

sound to me like it would be a waste of resources to have multiple ssrs databases... besides I honestly don't think it would work.

Report server security feature is very good, that is the only reason I can think of why you might want to seperate them.

|||Thanks for you quick reply. I really do need to do more reading/research. As long as I can keep groups separated, that will work.

Again - Thanks.
|||Hey JoeyDba,
How's it going today? Did you find any more answers?

Sunday, March 25, 2012

Default Databases and Windows Groups

Hello!
I have a question about default databases and Windows groups. A Windows
login is a member of two Windows groups. These two Windows groups have been
granted access to a sql server.
Login1 Member of Group1 and Group2
Group1 DefaultDbA
Group2 DefaultDbB
How is the default database determined if Login1 is connecting to the sql
server?
Best regards
Ola HallengrenThis is, to the best of my knowledge, not deterministic. There is not setting for this. So, it could
go either way. IMO, an app should never depend on default database - it should set the database in
the connection string. You could, of course, add Login! as a login to SQL Server and specify the
default database for that login (I'm pretty certain that this would be honored).
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Ola Hallengren" <OlaHallengren@.discussions.microsoft.com> wrote in message
news:5A8547EF-89D3-4BE0-BD3F-AD1899F40F0B@.microsoft.com...
> Hello!
> I have a question about default databases and Windows groups. A Windows
> login is a member of two Windows groups. These two Windows groups have been
> granted access to a sql server.
> Login1 Member of Group1 and Group2
> Group1 DefaultDbA
> Group2 DefaultDbB
> How is the default database determined if Login1 is connecting to the sql
> server?
> Best regards
> Ola Hallengren|||Thanks, Tibor. I agree with you that applications should not depend on
default databases. This is not a problem for us. The problem we have is with
the administrators managing the database servers using the SQL Server client
tools.
Enterprise Manager
If the default database is not accessible you can not log on.
Query Analyzer
If the default database is not accessible you can not log on.
Management Studio
There is an option to specify a database in the connection that enables you
to log on, even if the default database is not accessible. However then the
graphical dialogs is not working.
We're considering going away from using default databases (leaving it to
master on all logins).
/Ola
"Tibor Karaszi" wrote:
> This is, to the best of my knowledge, not deterministic. There is not setting for this. So, it could
> go either way. IMO, an app should never depend on default database - it should set the database in
> the connection string. You could, of course, add Login! as a login to SQL Server and specify the
> default database for that login (I'm pretty certain that this would be honored).
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Ola Hallengren" <OlaHallengren@.discussions.microsoft.com> wrote in message
> news:5A8547EF-89D3-4BE0-BD3F-AD1899F40F0B@.microsoft.com...
> > Hello!
> >
> > I have a question about default databases and Windows groups. A Windows
> > login is a member of two Windows groups. These two Windows groups have been
> > granted access to a sql server.
> >
> > Login1 Member of Group1 and Group2
> >
> > Group1 DefaultDbA
> > Group2 DefaultDbB
> >
> > How is the default database determined if Login1 is connecting to the sql
> > server?
> >
> > Best regards
> >
> > Ola Hallengren
>|||> We're considering going away from using default databases (leaving it to
> master on all logins).
This is what I do. And I then let the tool specify the database (/d for QA, in the registered server
for SSMS etc.)
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Ola Hallengren" <OlaHallengren@.discussions.microsoft.com> wrote in message
news:5D4CCE2E-E6BD-48DC-832D-517AB35364A4@.microsoft.com...
> Thanks, Tibor. I agree with you that applications should not depend on
> default databases. This is not a problem for us. The problem we have is with
> the administrators managing the database servers using the SQL Server client
> tools.
> Enterprise Manager
> If the default database is not accessible you can not log on.
> Query Analyzer
> If the default database is not accessible you can not log on.
> Management Studio
> There is an option to specify a database in the connection that enables you
> to log on, even if the default database is not accessible. However then the
> graphical dialogs is not working.
> We're considering going away from using default databases (leaving it to
> master on all logins).
> /Ola
>
> "Tibor Karaszi" wrote:
>> This is, to the best of my knowledge, not deterministic. There is not setting for this. So, it
>> could
>> go either way. IMO, an app should never depend on default database - it should set the database
>> in
>> the connection string. You could, of course, add Login! as a login to SQL Server and specify the
>> default database for that login (I'm pretty certain that this would be honored).
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://www.solidqualitylearning.com/
>>
>> "Ola Hallengren" <OlaHallengren@.discussions.microsoft.com> wrote in message
>> news:5A8547EF-89D3-4BE0-BD3F-AD1899F40F0B@.microsoft.com...
>> > Hello!
>> >
>> > I have a question about default databases and Windows groups. A Windows
>> > login is a member of two Windows groups. These two Windows groups have been
>> > granted access to a sql server.
>> >
>> > Login1 Member of Group1 and Group2
>> >
>> > Group1 DefaultDbA
>> > Group2 DefaultDbB
>> >
>> > How is the default database determined if Login1 is connecting to the sql
>> > server?
>> >
>> > Best regards
>> >
>> > Ola Hallengren
>>|||Perfect Match Finder
http://www.max-online.biz/idevaffiliate/idevaffiliate.php?id=804
Online Web Promotion
http://www.max-online.biz/idevaffiliate/idevaffiliate.php?id=804
For further details email me at maxonline.sunil@.gmail.com|||> I'm thinking if there is a way to trace if the applications are specifying a
> database on connection, or if they are depending on the default databases.
Seems like Profiler can show you this. If you capture the "User Error Message" event, you will see a
"Changed database context to dbname" events when you start the app. I guess this is the same as if
you do an explicit USE in the code, but whichever the app uses will make the app independent of the
default database for the login.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Ola Hallengren" <OlaHallengren@.discussions.microsoft.com> wrote in message
news:6207977A-193E-4FED-832C-E302E37F5BD4@.microsoft.com...
> >IMO, an app should never depend on default database - it should set the
> database in the connection string.
> I'm thinking if there is a way to trace if the applications are specifying a
> database on connection, or if they are depending on the default databases.
> One way is of course to to change the default databases to master and see
> which applications that fails. Is there a more elegant way?
> /Ola Hallengren
>
> "Tibor Karaszi" wrote:
>> > We're considering going away from using default databases (leaving it to
>> > master on all logins).
>> This is what I do. And I then let the tool specify the database (/d for QA, in the registered
>> server
>> for SSMS etc.)
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://www.solidqualitylearning.com/
>>
>> "Ola Hallengren" <OlaHallengren@.discussions.microsoft.com> wrote in message
>> news:5D4CCE2E-E6BD-48DC-832D-517AB35364A4@.microsoft.com...
>> > Thanks, Tibor. I agree with you that applications should not depend on
>> > default databases. This is not a problem for us. The problem we have is with
>> > the administrators managing the database servers using the SQL Server client
>> > tools.
>> >
>> > Enterprise Manager
>> > If the default database is not accessible you can not log on.
>> >
>> > Query Analyzer
>> > If the default database is not accessible you can not log on.
>> >
>> > Management Studio
>> > There is an option to specify a database in the connection that enables you
>> > to log on, even if the default database is not accessible. However then the
>> > graphical dialogs is not working.
>> >
>> > We're considering going away from using default databases (leaving it to
>> > master on all logins).
>> >
>> > /Ola
>> >
>> >
>> >
>> > "Tibor Karaszi" wrote:
>> >
>> >> This is, to the best of my knowledge, not deterministic. There is not setting for this. So, it
>> >> could
>> >> go either way. IMO, an app should never depend on default database - it should set the
>> >> database
>> >> in
>> >> the connection string. You could, of course, add Login! as a login to SQL Server and specify
>> >> the
>> >> default database for that login (I'm pretty certain that this would be honored).
>> >>
>> >> --
>> >> Tibor Karaszi, SQL Server MVP
>> >> http://www.karaszi.com/sqlserver/default.asp
>> >> http://www.solidqualitylearning.com/
>> >>
>> >>
>> >> "Ola Hallengren" <OlaHallengren@.discussions.microsoft.com> wrote in message
>> >> news:5A8547EF-89D3-4BE0-BD3F-AD1899F40F0B@.microsoft.com...
>> >> > Hello!
>> >> >
>> >> > I have a question about default databases and Windows groups. A Windows
>> >> > login is a member of two Windows groups. These two Windows groups have been
>> >> > granted access to a sql server.
>> >> >
>> >> > Login1 Member of Group1 and Group2
>> >> >
>> >> > Group1 DefaultDbA
>> >> > Group2 DefaultDbB
>> >> >
>> >> > How is the default database determined if Login1 is connecting to the sql
>> >> > server?
>> >> >
>> >> > Best regards
>> >> >
>> >> > Ola Hallengren
>> >>
>> >>
>>|||I've done some tests with this and unfortunately it doesn't seem to work.
I have a database called [TestDb] and a login called [test]. The login
[test] has been granted access to the database [TestDb]. [TestDb] is also the
default database.
Scenario 1: Logging in using sqlcmd and not specifying a database (depending
on the default database).
sqlcmd -S Server1 -U test -P test
Profiler shows the User Error Message below.
Changed database context to 'TestDb'.
Scenario 2: Logging in using sqlcmd and specifying a database (not depending
on the default database)
sqlcmd -S Server1 -U test -P test -d TestDb
Profiler shows the User Error Message below.
Changed database context to 'TestDb'.
As I see it I can not determine if a database is specified in the connection
or if it is depending on the default database.
/Ola
"Tibor Karaszi" wrote:
> > I'm thinking if there is a way to trace if the applications are specifying a
> > database on connection, or if they are depending on the default databases.
> Seems like Profiler can show you this. If you capture the "User Error Message" event, you will see a
> "Changed database context to dbname" events when you start the app. I guess this is the same as if
> you do an explicit USE in the code, but whichever the app uses will make the app independent of the
> default database for the login.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Ola Hallengren" <OlaHallengren@.discussions.microsoft.com> wrote in message
> news:6207977A-193E-4FED-832C-E302E37F5BD4@.microsoft.com...
> > >IMO, an app should never depend on default database - it should set the
> > database in the connection string.
> >
> > I'm thinking if there is a way to trace if the applications are specifying a
> > database on connection, or if they are depending on the default databases.
> > One way is of course to to change the default databases to master and see
> > which applications that fails. Is there a more elegant way?
> >
> > /Ola Hallengren
> >
> >
> >
> > "Tibor Karaszi" wrote:
> >
> >> > We're considering going away from using default databases (leaving it to
> >> > master on all logins).
> >>
> >> This is what I do. And I then let the tool specify the database (/d for QA, in the registered
> >> server
> >> for SSMS etc.)
> >>
> >> --
> >> Tibor Karaszi, SQL Server MVP
> >> http://www.karaszi.com/sqlserver/default.asp
> >> http://www.solidqualitylearning.com/
> >>
> >>
> >> "Ola Hallengren" <OlaHallengren@.discussions.microsoft.com> wrote in message
> >> news:5D4CCE2E-E6BD-48DC-832D-517AB35364A4@.microsoft.com...
> >> > Thanks, Tibor. I agree with you that applications should not depend on
> >> > default databases. This is not a problem for us. The problem we have is with
> >> > the administrators managing the database servers using the SQL Server client
> >> > tools.
> >> >
> >> > Enterprise Manager
> >> > If the default database is not accessible you can not log on.
> >> >
> >> > Query Analyzer
> >> > If the default database is not accessible you can not log on.
> >> >
> >> > Management Studio
> >> > There is an option to specify a database in the connection that enables you
> >> > to log on, even if the default database is not accessible. However then the
> >> > graphical dialogs is not working.
> >> >
> >> > We're considering going away from using default databases (leaving it to
> >> > master on all logins).
> >> >
> >> > /Ola
> >> >
> >> >
> >> >
> >> > "Tibor Karaszi" wrote:
> >> >
> >> >> This is, to the best of my knowledge, not deterministic. There is not setting for this. So, it
> >> >> could
> >> >> go either way. IMO, an app should never depend on default database - it should set the
> >> >> database
> >> >> in
> >> >> the connection string. You could, of course, add Login! as a login to SQL Server and specify
> >> >> the
> >> >> default database for that login (I'm pretty certain that this would be honored).
> >> >>
> >> >> --
> >> >> Tibor Karaszi, SQL Server MVP
> >> >> http://www.karaszi.com/sqlserver/default.asp
> >> >> http://www.solidqualitylearning.com/
> >> >>
> >> >>
> >> >> "Ola Hallengren" <OlaHallengren@.discussions.microsoft.com> wrote in message
> >> >> news:5A8547EF-89D3-4BE0-BD3F-AD1899F40F0B@.microsoft.com...
> >> >> > Hello!
> >> >> >
> >> >> > I have a question about default databases and Windows groups. A Windows
> >> >> > login is a member of two Windows groups. These two Windows groups have been
> >> >> > granted access to a sql server.
> >> >> >
> >> >> > Login1 Member of Group1 and Group2
> >> >> >
> >> >> > Group1 DefaultDbA
> >> >> > Group2 DefaultDbB
> >> >> >
> >> >> > How is the default database determined if Login1 is connecting to the sql
> >> >> > server?
> >> >> >
> >> >> > Best regards
> >> >> >
> >> >> > Ola Hallengren
> >> >>
> >> >>
> >>
> >>
>sql

Default Databases and Windows Groups

Hello!
I have a question about default databases and Windows groups. A Windows
login is a member of two Windows groups. These two Windows groups have been
granted access to a sql server.
Login1Member of Group1 and Group2
Group1DefaultDbA
Group2DefaultDbB
How is the default database determined if Login1 is connecting to the sql
server?
Best regards
Ola Hallengren
Thanks, Tibor. I agree with you that applications should not depend on
default databases. This is not a problem for us. The problem we have is with
the administrators managing the database servers using the SQL Server client
tools.
Enterprise Manager
If the default database is not accessible you can not log on.
Query Analyzer
If the default database is not accessible you can not log on.
Management Studio
There is an option to specify a database in the connection that enables you
to log on, even if the default database is not accessible. However then the
graphical dialogs is not working.
We're considering going away from using default databases (leaving it to
master on all logins).
/Ola
"Tibor Karaszi" wrote:

> This is, to the best of my knowledge, not deterministic. There is not setting for this. So, it could
> go either way. IMO, an app should never depend on default database - it should set the database in
> the connection string. You could, of course, add Login! as a login to SQL Server and specify the
> default database for that login (I'm pretty certain that this would be honored).
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Ola Hallengren" <OlaHallengren@.discussions.microsoft.com> wrote in message
> news:5A8547EF-89D3-4BE0-BD3F-AD1899F40F0B@.microsoft.com...
>
|||Perfect Match Finder
http://www.max-online.biz/idevaffiliate/idevaffiliate.php?id=804
Online Web Promotion
http://www.max-online.biz/idevaffiliate/idevaffiliate.php?id=804
For further details email me at maxonline.sunil@.gmail.com
|||>IMO, an app should never depend on default database - it should set the
database in the connection string.
I'm thinking if there is a way to trace if the applications are specifying a
database on connection, or if they are depending on the default databases.
One way is of course to to change the default databases to master and see
which applications that fails. Is there a more elegant way?
/Ola Hallengren
"Tibor Karaszi" wrote:

> This is what I do. And I then let the tool specify the database (/d for QA, in the registered server
> for SSMS etc.)
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Ola Hallengren" <OlaHallengren@.discussions.microsoft.com> wrote in message
> news:5D4CCE2E-E6BD-48DC-832D-517AB35364A4@.microsoft.com...
>

Default Databases and Windows Groups

Hello!
I have a question about default databases and Windows groups. A Windows
login is a member of two Windows groups. These two Windows groups have been
granted access to a sql server.
Login1 Member of Group1 and Group2
Group1 DefaultDbA
Group2 DefaultDbB
How is the default database determined if Login1 is connecting to the sql
server?
Best regards
Ola HallengrenThis is, to the best of my knowledge, not deterministic. There is not settin
g for this. So, it could
go either way. IMO, an app should never depend on default database - it shou
ld set the database in
the connection string. You could, of course, add Login! as a login to SQL Se
rver and specify the
default database for that login (I'm pretty certain that this would be honor
ed).
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Ola Hallengren" <OlaHallengren@.discussions.microsoft.com> wrote in message
news:5A8547EF-89D3-4BE0-BD3F-AD1899F40F0B@.microsoft.com...
> Hello!
> I have a question about default databases and Windows groups. A Windows
> login is a member of two Windows groups. These two Windows groups have bee
n
> granted access to a sql server.
> Login1 Member of Group1 and Group2
> Group1 DefaultDbA
> Group2 DefaultDbB
> How is the default database determined if Login1 is connecting to the sql
> server?
> Best regards
> Ola Hallengren|||Thanks, Tibor. I agree with you that applications should not depend on
default databases. This is not a problem for us. The problem we have is with
the administrators managing the database servers using the SQL Server client
tools.
Enterprise Manager
If the default database is not accessible you can not log on.
Query Analyzer
If the default database is not accessible you can not log on.
Management Studio
There is an option to specify a database in the connection that enables you
to log on, even if the default database is not accessible. However then the
graphical dialogs is not working.
We're considering going away from using default databases (leaving it to
master on all logins).
/Ola
"Tibor Karaszi" wrote:

> This is, to the best of my knowledge, not deterministic. There is not sett
ing for this. So, it could
> go either way. IMO, an app should never depend on default database - it sh
ould set the database in
> the connection string. You could, of course, add Login! as a login to SQL
Server and specify the
> default database for that login (I'm pretty certain that this would be hon
ored).
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Ola Hallengren" <OlaHallengren@.discussions.microsoft.com> wrote in messag
e
> news:5A8547EF-89D3-4BE0-BD3F-AD1899F40F0B@.microsoft.com...
>|||> We're considering going away from using default databases (leaving it to
> master on all logins).
This is what I do. And I then let the tool specify the database (/d for QA,
in the registered server
for SSMS etc.)
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Ola Hallengren" <OlaHallengren@.discussions.microsoft.com> wrote in message
news:5D4CCE2E-E6BD-48DC-832D-517AB35364A4@.microsoft.com...[vbcol=seagreen]
> Thanks, Tibor. I agree with you that applications should not depend on
> default databases. This is not a problem for us. The problem we have is wi
th
> the administrators managing the database servers using the SQL Server clie
nt
> tools.
> Enterprise Manager
> If the default database is not accessible you can not log on.
> Query Analyzer
> If the default database is not accessible you can not log on.
> Management Studio
> There is an option to specify a database in the connection that enables yo
u
> to log on, even if the default database is not accessible. However then th
e
> graphical dialogs is not working.
> We're considering going away from using default databases (leaving it to
> master on all logins).
> /Ola
>
> "Tibor Karaszi" wrote:
>|||Perfect Match Finder
http://www.max-online.biz/idevaffil...iate.php?id=804
Online Web Promotion
http://www.max-online.biz/idevaffil...iate.php?id=804
For further details email me at maxonline.sunil@.gmail.com|||>IMO, an app should never depend on default database - it should set the
database in the connection string.
I'm thinking if there is a way to trace if the applications are specifying a
database on connection, or if they are depending on the default databases.
One way is of course to to change the default databases to master and see
which applications that fails. Is there a more elegant way?
/Ola Hallengren
"Tibor Karaszi" wrote:

> This is what I do. And I then let the tool specify the database (/d for QA
, in the registered server
> for SSMS etc.)
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Ola Hallengren" <OlaHallengren@.discussions.microsoft.com> wrote in messag
e
> news:5D4CCE2E-E6BD-48DC-832D-517AB35364A4@.microsoft.com...
>

default database

I using the copy database wizard to copy databases from one server to
another. When I copy a db to the new server, it changes the default db
setting for all the users of that db to 'master'. Am I not running the
wizard correctly?
If this is how it works, how do I reset the setting to the db name I want?
I can do it manually but I have atleat 5 databases I have to copy and each
has a lot of users.
Look up sp_defaultdb in Books Online.
http://www.aspfaq.com/
(Reverse address to reply.)
"sql" <sql@.discussions.microsoft.com> wrote in message
news:F2413537-6302-4194-9D7E-4AEBCFBE28F4@.microsoft.com...
> I using the copy database wizard to copy databases from one server to
> another. When I copy a db to the new server, it changes the default db
> setting for all the users of that db to 'master'. Am I not running the
> wizard correctly?
> If this is how it works, how do I reset the setting to the db name I want?
> I can do it manually but I have atleat 5 databases I have to copy and each
> has a lot of users.
sql

Thursday, March 22, 2012

Default Database

I am using SQL Server Management to access a remote SQL Server. That server
has many databases but I have rights to only one so I set that as the
default database. In the connection properties it shows the correct database
but when I open the connection to that server I get the list of all the
databases instead of just the one I set as default? How can I get it to open
(show) just that one database?
have a look in BooksOnLine for
ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/toolref9/html/469ea8e2-79b9-44c8-bb6f-f0e1c5dbf0f2.htm
Andrew J. Kelly SQL MVP
"Wayne" <wayneNoSpam@.hotmail.com> wrote in message
news:%23QC2YWnQHHA.4276@.TK2MSFTNGP02.phx.gbl...
>I am using SQL Server Management to access a remote SQL Server. That server
> has many databases but I have rights to only one so I set that as the
> default database. In the connection properties it shows the correct
> database
> but when I open the connection to that server I get the list of all the
> databases instead of just the one I set as default? How can I get it to
> open
> (show) just that one database?
>
|||Andrew;
Thanls for your response. I tried that link as a search argument in BOL but
it was not found? Is there another way I should locate it?
Wayne
"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
news:%23DjWvrnQHHA.3592@.TK2MSFTNGP06.phx.gbl...
> have a look in BooksOnLine for
> ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/toolref9/html/469ea8e2-79b9-44c8-bb6f-f0e1c5dbf0f2.htm
>
> --
> Andrew J. Kelly SQL MVP
> "Wayne" <wayneNoSpam@.hotmail.com> wrote in message
> news:%23QC2YWnQHHA.4276@.TK2MSFTNGP02.phx.gbl...
>
|||Andrew;
Thanks for the response. When I entered that as a Search in BOL it was not
found? Is there another way I can locate that?
Wayne
"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
news:%23DjWvrnQHHA.3592@.TK2MSFTNGP06.phx.gbl...
> have a look in BooksOnLine for
> ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/toolref9/html/469ea8e2-79b9-44c8-bb6f-f0e1c5dbf0f2.htm
>
> --
> Andrew J. Kelly SQL MVP
> "Wayne" <wayneNoSpam@.hotmail.com> wrote in message
> news:%23QC2YWnQHHA.4276@.TK2MSFTNGP02.phx.gbl...
>
|||Thanks... that worked.
"Andrea Montanari" <andrea.sqlDMO@.virgilio.it> wrote in message
news:523hi4F1mjp3rU1@.mid.individual.net...
> hi Wayne,
> Wayne wrote:
> paste the Url Andrew provided in the "Url:" box in the right pane of the
> BOL, near the "search" combo.. or just have a look at
> http://msdn2.microsoft.com/en-us/library/ms173849.aspx
> --
> Andrea Montanari (Microsoft MVP - SQL Server)
> http://www.asql.biz http://italy.mvps.org
> DbaMgr2k ver 0.21.0 - DbaMgr ver 0.65.0 and further SQL Tools
> -- remove DMO to reply
>

default database

I using the copy database wizard to copy databases from one server to
another. When I copy a db to the new server, it changes the default db
setting for all the users of that db to 'master'. Am I not running the
wizard correctly?
If this is how it works, how do I reset the setting to the db name I want?
I can do it manually but I have atleat 5 databases I have to copy and each
has a lot of users.Look up sp_defaultdb in Books Online.
--
http://www.aspfaq.com/
(Reverse address to reply.)
"sql" <sql@.discussions.microsoft.com> wrote in message
news:F2413537-6302-4194-9D7E-4AEBCFBE28F4@.microsoft.com...
> I using the copy database wizard to copy databases from one server to
> another. When I copy a db to the new server, it changes the default db
> setting for all the users of that db to 'master'. Am I not running the
> wizard correctly?
> If this is how it works, how do I reset the setting to the db name I want?
> I can do it manually but I have atleat 5 databases I have to copy and each
> has a lot of users.

Wednesday, March 21, 2012

Decrypting Stored Procedures

We have a product that compares databases and generates the scripts to
synchronize them. Need to be able to compare encrypted Stored Procedures - is
there an official route for obtaining the information we need?
xSQL wrote:
> We have a product that compares databases and generates the scripts to
> synchronize them. Need to be able to compare encrypted Stored
> Procedures - is there an official route for obtaining the information
> we need?
Nothing official. They are encrypted, so the procedure text is not
available through normal means. You can decrypt the stored procedures
using some posted code available on the internet, but this will change
the system tables where the encrypted text is stored. There's no way to
read the encrypted text and decrypt on the fly as far as I know using a
schema comparison tool. Decrypting the procedures could be a violation
of any of a number of US and international laws if you are not the
owner.
David Gugick
Quest Software
www.imceda.com
www.quest.com

Sunday, March 11, 2012

Declaring and using an UPDATE CURSOR with SQL SERVER

In databases like Oracle or Sybase, if you have multiple records returned
from a query and want to update them, you declare an update cursor.
While I have read the "Help" files available in Enterprise, I have not
figured out the syntax for declaring and using an UPDATE CURSOR.
The query I am running is like this:
UPDATE A
SET A.Field1 = (SELECT B.Field1
FROM B INNER JOIN A ON A.id = B.id)
The tables have a many to one relationship on id.
I do not know if when I declare the cursor, if I put the whole update
statement in it... I do not know if when I use an update cursor, I have to
fetch next... And beyond that, if I do get the syntax and put it into a
stored procedure, how do I execute the query from within Enterprise Manager
(I am not writing code to call the procedure, I just want to execute it
against the table. I would execute it by just creating a query, but the
cursor format is not recognized in the query pane.)
I am completely new to SQL Server but not to databases.
What I am looking for is just a simple example of declaring and using an
UPDATE CURSOR.
Any help you can provide would be appreciated. Thanks!Hi
you can use somewhat this
Update
Set A.Field1 = B.Field
From
Where A.id = B.i
This statement this convert to UPDATE CURSOR in Oracle
Hermilson Tinoco.|||The simple syntax for declaring a cursor which allows updates is doc'd in
SQL books online , search for "Declare cursor", but it looks like
declare mycur Cursor for <Select statement> for update
you can then open it, fetch rows, and update table set col = value where
current of mycur
Generally in SQL, we try to avoid cursors and use relational update
statements whenever possible, because cursors (generally) do not perform as
well.
hope this helps.
"Carol Berry" <carol@.123marbella.com> wrote in message
news:OAGSMlx6DHA.2404@.TK2MSFTNGP11.phx.gbl...
> In databases like Oracle or Sybase, if you have multiple records returned
> from a query and want to update them, you declare an update cursor.
> While I have read the "Help" files available in Enterprise, I have not
> figured out the syntax for declaring and using an UPDATE CURSOR.
> The query I am running is like this:
> UPDATE A
> SET A.Field1 => (SELECT B.Field1
> FROM B INNER JOIN A ON A.id = B.id)
> The tables have a many to one relationship on id.
> I do not know if when I declare the cursor, if I put the whole update
> statement in it... I do not know if when I use an update cursor, I have
to
> fetch next... And beyond that, if I do get the syntax and put it into a
> stored procedure, how do I execute the query from within Enterprise
Manager
> (I am not writing code to call the procedure, I just want to execute it
> against the table. I would execute it by just creating a query, but the
> cursor format is not recognized in the query pane.)
> I am completely new to SQL Server but not to databases.
> What I am looking for is just a simple example of declaring and using an
> UPDATE CURSOR.
> Any help you can provide would be appreciated. Thanks!
>

Declaring and using an UPDATE CURSOR with SQL SERVER

In databases like Oracle or Sybase, if you have multiple records returned
from a query and want to update them, you declare an update cursor.
While I have read the "Help" files available in Enterprise, I have not
figured out the syntax for declaring and using an UPDATE CURSOR.
The query I am running is like this:
UPDATE A
SET A.Field1 =
(SELECT B.Field1
FROM B INNER JOIN A ON A.id = B.id)
The tables have a many to one relationship on id.
I do not know if when I declare the cursor, if I put the whole update
statement in it... I do not know if when I use an update cursor, I have to
fetch next... And beyond that, if I do get the syntax and put it into a
stored procedure, how do I execute the query from within Enterprise Manager
(I am not writing code to call the procedure, I just want to execute it
against the table. I would execute it by just creating a query, but the
cursor format is not recognized in the query pane.)
I am completely new to SQL Server but not to databases.
What I am looking for is just a simple example of declaring and using an
UPDATE CURSOR.
Any help you can provide would be appreciated. Thanks!Hi.
you can use somewhat this:
Update A
Set A.Field1 = B.Field1
From B
Where A.id = B.id
This statement this convert to UPDATE CURSOR in Oracle.
Hermilson Tinoco.|||The simple syntax for declaring a cursor which allows updates is doc'd in
SQL books online , search for "Declare cursor", but it looks like
declare mycur Cursor for <Select statement> for update
you can then open it, fetch rows, and update table set col = value where
current of mycur
Generally in SQL, we try to avoid cursors and use relational update
statements whenever possible, because cursors (generally) do not perform as
well.
hope this helps.
"Carol Berry" <carol@.123marbella.com> wrote in message
news:OAGSMlx6DHA.2404@.TK2MSFTNGP11.phx.gbl...
quote:

> In databases like Oracle or Sybase, if you have multiple records returned
> from a query and want to update them, you declare an update cursor.
> While I have read the "Help" files available in Enterprise, I have not
> figured out the syntax for declaring and using an UPDATE CURSOR.
> The query I am running is like this:
> UPDATE A
> SET A.Field1 =
> (SELECT B.Field1
> FROM B INNER JOIN A ON A.id = B.id)
> The tables have a many to one relationship on id.
> I do not know if when I declare the cursor, if I put the whole update
> statement in it... I do not know if when I use an update cursor, I have

to
quote:

> fetch next... And beyond that, if I do get the syntax and put it into a
> stored procedure, how do I execute the query from within Enterprise

Manager
quote:

> (I am not writing code to call the procedure, I just want to execute it
> against the table. I would execute it by just creating a query, but the
> cursor format is not recognized in the query pane.)
> I am completely new to SQL Server but not to databases.
> What I am looking for is just a simple example of declaring and using an
> UPDATE CURSOR.
> Any help you can provide would be appreciated. Thanks!
>
|||Thank you all for your help. If I need more help, I will post a more
complete problem. I am new to "posting" issues, too.
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!