Showing posts with label users. Show all posts
Showing posts with label users. Show all posts

Friday, March 30, 2012

pros/cons keeping master as default db

Is there any concern in leaving master as a user's default database or
should it be changed to another db?
Thanks
Brian
One downside changing it is that most tools doesn't allow you to login if you remove your default
database.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Brian D" <bdaltilio@.yahoo.com> wrote in message
news:1179339438.486854.196200@.q23g2000hsg.googlegr oups.com...
> Is there any concern in leaving master as a user's default database or
> should it be changed to another db?
> Thanks
> Brian
>
|||Brian,
My take is that master is a safe default for everybody who does not have
rights to modify master. For those of us who _can_ modify master, please be
careful.
RLF
"Brian D" <bdaltilio@.yahoo.com> wrote in message
news:1179339438.486854.196200@.q23g2000hsg.googlegr oups.com...
> Is there any concern in leaving master as a user's default database or
> should it be changed to another db?
> Thanks
> Brian
>

Wednesday, March 28, 2012

properties owner and users owner.

In the properties section of a database there is a owner.
Under the users of a database there is the dbo with
a Login Name.
What is the difference between the 'two owners' ?
ben brugmanHi,
"Both can be same in most of the situation."
DBO - DBO is a role, A user with a DBO role can do any activities inside
the database.
Properties section of a database there is a owner?
He will be person who creates the database. By default he will a DBO. This
owner can be changed using the procedure,
sp_changedbowner.
Thanks
Hari
MCDBA
"ben brugman" <ben@.niethier.nl> wrote in message
news:eCuSx$chEHA.4064@.TK2MSFTNGP12.phx.gbl...
> In the properties section of a database there is a owner.
> Under the users of a database there is the dbo with
> a Login Name.
> What is the difference between the 'two owners' ?
> ben brugman
>|||Thanks for your time and quick response,
see inline :
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:O2$NJIdhEHA.2052@.tk2msftngp13.phx.gbl...
> Hi,
> "Both can be same in most of the situation."
I tried to make both the same.

> DBO - DBO is a role, A user with a DBO role can do any activities inside
> the database.
> Properties section of a database there is a owner?
> He will be person who creates the database. By default he will a DBO. This
> owner can be changed using the procedure,
> sp_changedbowner.
I cannot change the owner because :
"
Server: Msg 15110, Level 16, State 1, Procedure sp_changedbowner, Line 46
The proposed new database owner is already a user in the database.
"
And in the database he is the dbo owner, so I do not think deleting that
owner
is wise.
I still have difficulty grasping the difference between the two owners and
still would like them to be the same.
Thanks
ben brugman

> Thanks
> Hari
> MCDBA
>
>
> "ben brugman" <ben@.niethier.nl> wrote in message
> news:eCuSx$chEHA.4064@.TK2MSFTNGP12.phx.gbl...
>|||Hari
DBO is a privileged user.
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:O2$NJIdhEHA.2052@.tk2msftngp13.phx.gbl...
> Hi,
> "Both can be same in most of the situation."
> DBO - DBO is a role, A user with a DBO role can do any activities inside
> the database.
> Properties section of a database there is a owner?
> He will be person who creates the database. By default he will a DBO. This
> owner can be changed using the procedure,
> sp_changedbowner.
> Thanks
> Hari
> MCDBA
>
>
> "ben brugman" <ben@.niethier.nl> wrote in message
> news:eCuSx$chEHA.4064@.TK2MSFTNGP12.phx.gbl...
>|||'dbo' is a special database user and must exist in every database. The
database owner is the *login* that is mapped to the database 'dbo' user and
this mapping is stored in 2 places, sysdatabases and sysusers. These should
normally be the same login but can get out-of-sync in some situations, such
as a restore or attach. The query below will return the same login if the
owner entries are synchronized:
USE MyDatabase
SELECT 'sysdatabases mapping=' + SUSER_SNAME(sid)
FROM master..sysdatabases
WHERE name = DB_NAME()
UNION ALL
SELECT 'sysusers mapping=' + SUSER_SNAME(sid)
FROM sysusers
WHERE name = 'dbo'
You can execute sp_changedbowner to change or correct the mapping. If you
get error 15110, ensure the specified login is not already a database user
since a login can be mapped to only one database user at a time.
The 15110 error can also be raised due to an out-of-sync condition mentioned
above. In that case, temporarily change database ownership to a
non-conflicting login and then to the desired login like the example below:
USE MyDatabase
EXEC sp_addlogin 'TempOwner'
EXEC sp_changedbowner 'TempOwner'
EXEC sp_changedbowner 'MyDatabaseOwner'
EXEC sp_droplogin 'TempOwner'
GO
Hope this helps.
Dan Guzman
SQL Server MVP
"ben brugman" <ben@.niethier.nl> wrote in message
news:%23nqiINdhEHA.3076@.tk2msftngp13.phx.gbl...
> Thanks for your time and quick response,
> see inline :
> "Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
> news:O2$NJIdhEHA.2052@.tk2msftngp13.phx.gbl...
> I tried to make both the same.
>
inside[vbcol=seagreen]
This[vbcol=seagreen]
> I cannot change the owner because :
> "
> Server: Msg 15110, Level 16, State 1, Procedure sp_changedbowner, Line 46
> The proposed new database owner is already a user in the database.
> "
> And in the database he is the dbo owner, so I do not think deleting that
> owner
> is wise.
> I still have difficulty grasping the difference between the two owners and
> still would like them to be the same.
> Thanks
> ben brugman
>
>sql

properties owner and users owner.

In the properties section of a database there is a owner.
Under the users of a database there is the dbo with
a Login Name.
What is the difference between the 'two owners' ?
ben brugmanHi,
"Both can be same in most of the situation."
DBO - DBO is a role, A user with a DBO role can do any activities inside
the database.
Properties section of a database there is a owner?
He will be person who creates the database. By default he will a DBO. This
owner can be changed using the procedure,
sp_changedbowner.
Thanks
Hari
MCDBA
"ben brugman" <ben@.niethier.nl> wrote in message
news:eCuSx$chEHA.4064@.TK2MSFTNGP12.phx.gbl...
> In the properties section of a database there is a owner.
> Under the users of a database there is the dbo with
> a Login Name.
> What is the difference between the 'two owners' ?
> ben brugman
>|||Hari
DBO is a privileged user.
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:O2$NJIdhEHA.2052@.tk2msftngp13.phx.gbl...
> Hi,
> "Both can be same in most of the situation."
> DBO - DBO is a role, A user with a DBO role can do any activities inside
> the database.
> Properties section of a database there is a owner?
> He will be person who creates the database. By default he will a DBO. This
> owner can be changed using the procedure,
> sp_changedbowner.
> Thanks
> Hari
> MCDBA
>
>
> "ben brugman" <ben@.niethier.nl> wrote in message
> news:eCuSx$chEHA.4064@.TK2MSFTNGP12.phx.gbl...
> > In the properties section of a database there is a owner.
> >
> > Under the users of a database there is the dbo with
> > a Login Name.
> >
> > What is the difference between the 'two owners' ?
> >
> > ben brugman
> >
> >
>|||Thanks for your time and quick response,
see inline :
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:O2$NJIdhEHA.2052@.tk2msftngp13.phx.gbl...
> Hi,
> "Both can be same in most of the situation."
I tried to make both the same.
> DBO - DBO is a role, A user with a DBO role can do any activities inside
> the database.
> Properties section of a database there is a owner?
> He will be person who creates the database. By default he will a DBO. This
> owner can be changed using the procedure,
> sp_changedbowner.
I cannot change the owner because :
"
Server: Msg 15110, Level 16, State 1, Procedure sp_changedbowner, Line 46
The proposed new database owner is already a user in the database.
"
And in the database he is the dbo owner, so I do not think deleting that
owner
is wise.
I still have difficulty grasping the difference between the two owners and
still would like them to be the same.
Thanks
ben brugman
> Thanks
> Hari
> MCDBA
>
>
> "ben brugman" <ben@.niethier.nl> wrote in message
> news:eCuSx$chEHA.4064@.TK2MSFTNGP12.phx.gbl...
> > In the properties section of a database there is a owner.
> >
> > Under the users of a database there is the dbo with
> > a Login Name.
> >
> > What is the difference between the 'two owners' ?
> >
> > ben brugman
> >
> >
>|||'dbo' is a special database user and must exist in every database. The
database owner is the *login* that is mapped to the database 'dbo' user and
this mapping is stored in 2 places, sysdatabases and sysusers. These should
normally be the same login but can get out-of-sync in some situations, such
as a restore or attach. The query below will return the same login if the
owner entries are synchronized:
USE MyDatabase
SELECT 'sysdatabases mapping=' + SUSER_SNAME(sid)
FROM master..sysdatabases
WHERE name = DB_NAME()
UNION ALL
SELECT 'sysusers mapping=' + SUSER_SNAME(sid)
FROM sysusers
WHERE name = 'dbo'
You can execute sp_changedbowner to change or correct the mapping. If you
get error 15110, ensure the specified login is not already a database user
since a login can be mapped to only one database user at a time.
The 15110 error can also be raised due to an out-of-sync condition mentioned
above. In that case, temporarily change database ownership to a
non-conflicting login and then to the desired login like the example below:
USE MyDatabase
EXEC sp_addlogin 'TempOwner'
EXEC sp_changedbowner 'TempOwner'
EXEC sp_changedbowner 'MyDatabaseOwner'
EXEC sp_droplogin 'TempOwner'
GO
--
Hope this helps.
Dan Guzman
SQL Server MVP
"ben brugman" <ben@.niethier.nl> wrote in message
news:%23nqiINdhEHA.3076@.tk2msftngp13.phx.gbl...
> Thanks for your time and quick response,
> see inline :
> "Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
> news:O2$NJIdhEHA.2052@.tk2msftngp13.phx.gbl...
> > Hi,
> >
> > "Both can be same in most of the situation."
> I tried to make both the same.
> >
> > DBO - DBO is a role, A user with a DBO role can do any activities
inside
> > the database.
> >
> > Properties section of a database there is a owner?
> >
> > He will be person who creates the database. By default he will a DBO.
This
> > owner can be changed using the procedure,
> >
> > sp_changedbowner.
> I cannot change the owner because :
> "
> Server: Msg 15110, Level 16, State 1, Procedure sp_changedbowner, Line 46
> The proposed new database owner is already a user in the database.
> "
> And in the database he is the dbo owner, so I do not think deleting that
> owner
> is wise.
> I still have difficulty grasping the difference between the two owners and
> still would like them to be the same.
> Thanks
> ben brugman
> >
> > Thanks
> > Hari
> > MCDBA
> >
> >
> >
> >
> > "ben brugman" <ben@.niethier.nl> wrote in message
> > news:eCuSx$chEHA.4064@.TK2MSFTNGP12.phx.gbl...
> > > In the properties section of a database there is a owner.
> > >
> > > Under the users of a database there is the dbo with
> > > a Login Name.
> > >
> > > What is the difference between the 'two owners' ?
> > >
> > > ben brugman
> > >
> > >
> >
> >
>

properties owner and users owner.

In the properties section of a database there is a owner.
Under the users of a database there is the dbo with
a Login Name.
What is the difference between the 'two owners' ?
ben brugman
Hi,
"Both can be same in most of the situation."
DBO - DBO is a role, A user with a DBO role can do any activities inside
the database.
Properties section of a database there is a owner?
He will be person who creates the database. By default he will a DBO. This
owner can be changed using the procedure,
sp_changedbowner.
Thanks
Hari
MCDBA
"ben brugman" <ben@.niethier.nl> wrote in message
news:eCuSx$chEHA.4064@.TK2MSFTNGP12.phx.gbl...
> In the properties section of a database there is a owner.
> Under the users of a database there is the dbo with
> a Login Name.
> What is the difference between the 'two owners' ?
> ben brugman
>
|||Thanks for your time and quick response,
see inline :
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:O2$NJIdhEHA.2052@.tk2msftngp13.phx.gbl...
> Hi,
> "Both can be same in most of the situation."
I tried to make both the same.

> DBO - DBO is a role, A user with a DBO role can do any activities inside
> the database.
> Properties section of a database there is a owner?
> He will be person who creates the database. By default he will a DBO. This
> owner can be changed using the procedure,
> sp_changedbowner.
I cannot change the owner because :
"
Server: Msg 15110, Level 16, State 1, Procedure sp_changedbowner, Line 46
The proposed new database owner is already a user in the database.
"
And in the database he is the dbo owner, so I do not think deleting that
owner
is wise.
I still have difficulty grasping the difference between the two owners and
still would like them to be the same.
Thanks
ben brugman

> Thanks
> Hari
> MCDBA
>
>
> "ben brugman" <ben@.niethier.nl> wrote in message
> news:eCuSx$chEHA.4064@.TK2MSFTNGP12.phx.gbl...
>
|||Hari
DBO is a privileged user.
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:O2$NJIdhEHA.2052@.tk2msftngp13.phx.gbl...
> Hi,
> "Both can be same in most of the situation."
> DBO - DBO is a role, A user with a DBO role can do any activities inside
> the database.
> Properties section of a database there is a owner?
> He will be person who creates the database. By default he will a DBO. This
> owner can be changed using the procedure,
> sp_changedbowner.
> Thanks
> Hari
> MCDBA
>
>
> "ben brugman" <ben@.niethier.nl> wrote in message
> news:eCuSx$chEHA.4064@.TK2MSFTNGP12.phx.gbl...
>
|||'dbo' is a special database user and must exist in every database. The
database owner is the *login* that is mapped to the database 'dbo' user and
this mapping is stored in 2 places, sysdatabases and sysusers. These should
normally be the same login but can get out-of-sync in some situations, such
as a restore or attach. The query below will return the same login if the
owner entries are synchronized:
USE MyDatabase
SELECT 'sysdatabases mapping=' + SUSER_SNAME(sid)
FROM master..sysdatabases
WHERE name = DB_NAME()
UNION ALL
SELECT 'sysusers mapping=' + SUSER_SNAME(sid)
FROM sysusers
WHERE name = 'dbo'
You can execute sp_changedbowner to change or correct the mapping. If you
get error 15110, ensure the specified login is not already a database user
since a login can be mapped to only one database user at a time.
The 15110 error can also be raised due to an out-of-sync condition mentioned
above. In that case, temporarily change database ownership to a
non-conflicting login and then to the desired login like the example below:
USE MyDatabase
EXEC sp_addlogin 'TempOwner'
EXEC sp_changedbowner 'TempOwner'
EXEC sp_changedbowner 'MyDatabaseOwner'
EXEC sp_droplogin 'TempOwner'
GO
Hope this helps.
Dan Guzman
SQL Server MVP
"ben brugman" <ben@.niethier.nl> wrote in message
news:%23nqiINdhEHA.3076@.tk2msftngp13.phx.gbl...[vbcol=seagreen]
> Thanks for your time and quick response,
> see inline :
> "Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
> news:O2$NJIdhEHA.2052@.tk2msftngp13.phx.gbl...
> I tried to make both the same.
inside[vbcol=seagreen]
This
> I cannot change the owner because :
> "
> Server: Msg 15110, Level 16, State 1, Procedure sp_changedbowner, Line 46
> The proposed new database owner is already a user in the database.
> "
> And in the database he is the dbo owner, so I do not think deleting that
> owner
> is wise.
> I still have difficulty grasping the difference between the two owners and
> still would like them to be the same.
> Thanks
> ben brugman
>
>

Monday, March 26, 2012

Properly copying data of datatype Image

I have a column called "Image" in a table that stores all the user information. Image holds the data for the user's badge photo. I'm currently working on a project to move some of the data from the users table to more relevant tables. With the SQL script I wrote to copy the data into the new tables the image data appears to not have been transferred correctly. I had tried storing the image data into a variable of type varbinary(8000) before inserting it back in. Is there a certain datatype that must be used to store the data when reading from a column of data type "image" and then inserting it into another column of data type "image" without getting truncation or corruption of the data?

Can you please try the following?

HOWTO: Read and Write BLOBs Using GetChunk and AppendChunk
http://support.microsoft.com/default.aspx?scid=kb;en-us;194975
HOWTO: Access and Modify SQL Server BLOB Data by Using the ADO Stream Object
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q258038
How To Read and Write BLOB Data by Using ADO.NET with Visual Basic .NET
http://support.microsoft.com/kb/308042/EN-US

Friday, March 23, 2012

Prompt Parameter in Ad Hoc Reports

Can i do this?
In the filter window, i want to add a field and make it into a prompt. But
then when the users run the report they should have the ability to not select
anything from the prompt and hence see the report for all values of that
field...On Feb 27, 11:47 am, Tk_Neo <T...@.discussions.microsoft.com> wrote:
> Can i do this?
> In the filter window, i want to add a field and make it into a prompt. But
> then when the users run the report they should have the ability to not select
> anything from the prompt and hence see the report for all values of that
> field...
One way of doing it is to create a report parameter for the filter
options (incl. no filter as an option) and either use the report
parameter value selected to filter with -or- use the report parameter
in the query or stored procedure to filter the results. Hope this
helps.
Regards,
Enrique Martinez
Sr. SQL Server Developer|||I posted a way to do this in the msdn forum:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1285083&SiteID=1
hth
Helen
"EMartinez" <emartinez.pr1@.gmail.com> wrote in message
news:1172636771.488607.218240@.t69g2000cwt.googlegroups.com...
> On Feb 27, 11:47 am, Tk_Neo <T...@.discussions.microsoft.com> wrote:
>> Can i do this?
>> In the filter window, i want to add a field and make it into a prompt.
>> But
>> then when the users run the report they should have the ability to not
>> select
>> anything from the prompt and hence see the report for all values of that
>> field...
> One way of doing it is to create a report parameter for the filter
> options (incl. no filter as an option) and either use the report
> parameter value selected to filter with -or- use the report parameter
> in the query or stored procedure to filter the results. Hope this
> helps.
> Regards,
> Enrique Martinez
> Sr. SQL Server Developer
>sql

Prompt for variable values in a SQL script

I am writing a SQL script and it needs some parameters to be entered by the user. Users will run this script from the SQL Query Analyzer. I trying to see if there is a way the script will prompt the user to enter values for the parameters. This is possible in Oracle. Is there any equivalent in SQL Server?

Thanks in advance for your timeNo, you can't prompt for variables in the SQL script.

You can create your script as a stored procedure with parameters, or you can define and set your variables at the top of the script so the user can easily modify them (good programming practice anyway!).

That said...
bad programming practice is letting users run scripts from Query Analyzer! I hope the "users" have knowledge of databases, and I hope their server and database permissions are well defined, or they could inadvertently (or even maliciously) mess things up.

Why not build a simple interface, such as an Access Data Project, that calls the procedure after prompting the User for parameters?

blindman|||I realize that it is a bad and dangerous practice to let the users access the database from the query analyzer. We are redesigning the system from the scratch but till then, we have to support the existing system. Prevoius DBA let this hole into the system and we have to live with this till we finish our re-design. I was almost positive what I was looking for is not possible but I just wanted to make sure. Thanks a lot for your time blindman.

Originally posted by blindman
No, you can't prompt for variables in the SQL script.

You can create your script as a stored procedure with parameters, or you can define and set your variables at the top of the script so the user can easily modify them (good programming practice anyway!).

That said...
bad programming practice is letting users run scripts from Query Analyzer! I hope the "users" have knowledge of databases, and I hope their server and database permissions are well defined, or they could inadvertently (or even maliciously) mess things up.

Why not build a simple interface, such as an Access Data Project, that calls the procedure after prompting the User for parameters?

blindman

Wednesday, March 21, 2012

Promoting a SQL Server 2000 to a DC

I manage a small Win 2k domain with 3 servers and about 20 users (IIS for ou
r
website on one server, DC & Exchange on one, SQL 2000/file/print on one). W
e
currently have a single DC in our domain and I want to promote one of the
other servers to a DC for backup purposes. The IIS box is out because it
hosts our public web page, which leaves me with the SQL box. I read that
DCPromo removes any local user accounts and am not sure of how this will
affect our SQL Server. It is currently using mixed authentication and start
s
as a system account. Any constructive feedback is appreciated.>
> I manage a small Win 2k domain with 3 servers and about 20 users (IIS for
our
> website on one server, DC & Exchange on one, SQL 2000/file/print on one).
We
> currently have a single DC in our domain and I want to promote one of the
> other servers to a DC for backup purposes. The IIS box is out because it
> hosts our public web page, which leaves me with the SQL box. I read that
> DCPromo removes any local user accounts and am not sure of how this will
> affect our SQL Server. It is currently using mixed authentication and
starts
> as a system account. Any constructive feedback is appreciated.
--
For performance reasons, we generally do not recommend running SQL Server
on a domain controller.
Regards,
Eric Crdenas
Senior support professional
This posting is provided "AS IS" with no warranties, and confers no rights.sql

Promoting a SQL Server 2000 to a DC

I manage a small Win 2k domain with 3 servers and about 20 users (IIS for our
website on one server, DC & Exchange on one, SQL 2000/file/print on one). We
currently have a single DC in our domain and I want to promote one of the
other servers to a DC for backup purposes. The IIS box is out because it
hosts our public web page, which leaves me with the SQL box. I read that
DCPromo removes any local user accounts and am not sure of how this will
affect our SQL Server. It is currently using mixed authentication and starts
as a system account. Any constructive feedback is appreciated.>
> I manage a small Win 2k domain with 3 servers and about 20 users (IIS for
our
> website on one server, DC & Exchange on one, SQL 2000/file/print on one).
We
> currently have a single DC in our domain and I want to promote one of the
> other servers to a DC for backup purposes. The IIS box is out because it
> hosts our public web page, which leaves me with the SQL box. I read that
> DCPromo removes any local user accounts and am not sure of how this will
> affect our SQL Server. It is currently using mixed authentication and
starts
> as a system account. Any constructive feedback is appreciated.
--
For performance reasons, we generally do not recommend running SQL Server
on a domain controller.
Regards,
--
Eric Cárdenas
Senior support professional
This posting is provided "AS IS" with no warranties, and confers no rights.

Promoting a SQL Server 2000 to a DC

I manage a small Win 2k domain with 3 servers and about 20 users (IIS for our
website on one server, DC & Exchange on one, SQL 2000/file/print on one). We
currently have a single DC in our domain and I want to promote one of the
other servers to a DC for backup purposes. The IIS box is out because it
hosts our public web page, which leaves me with the SQL box. I read that
DCPromo removes any local user accounts and am not sure of how this will
affect our SQL Server. It is currently using mixed authentication and starts
as a system account. Any constructive feedback is appreciated.
>
> I manage a small Win 2k domain with 3 servers and about 20 users (IIS for
our
> website on one server, DC & Exchange on one, SQL 2000/file/print on one).
We
> currently have a single DC in our domain and I want to promote one of the
> other servers to a DC for backup purposes. The IIS box is out because it
> hosts our public web page, which leaves me with the SQL box. I read that
> DCPromo removes any local user accounts and am not sure of how this will
> affect our SQL Server. It is currently using mixed authentication and
starts
> as a system account. Any constructive feedback is appreciated.
For performance reasons, we generally do not recommend running SQL Server
on a domain controller.
Regards,
Eric Crdenas
Senior support professional
This posting is provided "AS IS" with no warranties, and confers no rights.

Project structure when using RepSvcs

Hi,
I have a WinForm project in VS .NET and need to incorporate Reporting
Services.
The application will display the reports to the users on a form with an IE
control.
Is it possible to add the report items to the application project? or
Must I create a separate project of type report and have the reports there?
How could the reports be invoked by the application?
Thanks in advance,
RichardIf you are using IE control you have only one choice. One, the reports need
to be in their own project. Two, they have to be deployed to a server in
order to test your links.
As far as invoking the reports, it confuses me. You stated that you are
using the IE control. The only way to use this control is doing URL
integration. All you are doing is assembling a string and setting the URL
property for the control.
I guess in a convoluted way you could use web services, stream the html to a
file and give the IE control a
If you are using VS.Net 2005 then look at the new controls. There is a
winform and webform controls. The new winform control is a much better way
of integrating reports (I am using it in a Winform application. I use IE
control in a In-Touch application... real time control user interface).
--
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Richard" <Richard@.discussions.microsoft.com> wrote in message
news:F4FA857A-45A2-4158-A1ED-C238D66D6CD2@.microsoft.com...
> Hi,
> I have a WinForm project in VS .NET and need to incorporate Reporting
> Services.
> The application will display the reports to the users on a form with an IE
> control.
> Is it possible to add the report items to the application project? or
> Must I create a separate project of type report and have the reports
> there?
> How could the reports be invoked by the application?
> Thanks in advance,
> Richard|||Sorry Bruce, I meant a ReportViewer control on a WinForm.
"Bruce L-C [MVP]" wrote:
> If you are using IE control you have only one choice. One, the reports need
> to be in their own project. Two, they have to be deployed to a server in
> order to test your links.
> As far as invoking the reports, it confuses me. You stated that you are
> using the IE control. The only way to use this control is doing URL
> integration. All you are doing is assembling a string and setting the URL
> property for the control.
> I guess in a convoluted way you could use web services, stream the html to a
> file and give the IE control a
> If you are using VS.Net 2005 then look at the new controls. There is a
> winform and webform controls. The new winform control is a much better way
> of integrating reports (I am using it in a Winform application. I use IE
> control in a In-Touch application... real time control user interface).
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> "Richard" <Richard@.discussions.microsoft.com> wrote in message
> news:F4FA857A-45A2-4158-A1ED-C238D66D6CD2@.microsoft.com...
> > Hi,
> >
> > I have a WinForm project in VS .NET and need to incorporate Reporting
> > Services.
> > The application will display the reports to the users on a form with an IE
> > control.
> > Is it possible to add the report items to the application project? or
> > Must I create a separate project of type report and have the reports
> > there?
> > How could the reports be invoked by the application?
> >
> > Thanks in advance,
> >
> > Richard
>
>|||Ahhh, HUGE difference. There are two ways to use the Winform control: server
and local mode.
Server mode, develop your reports in a reports project, separately. Test out
your report there, deploy and then integrate with Winform control (which is
what I do).
Local mode. Develop report initially in a reports project. Test out report.
Copy rdl file, renaming it to rdlc. Bring the rdlc into your winform
project. Note that you do have much more to do to get full functionality of
a report in local mode. It is nowhere near as simple as integrating in a
report which is deployed to a server.
--
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Richard" <Richard@.discussions.microsoft.com> wrote in message
news:5820FB57-5FC6-4742-A571-1531CC73E4E0@.microsoft.com...
> Sorry Bruce, I meant a ReportViewer control on a WinForm.
> "Bruce L-C [MVP]" wrote:
>> If you are using IE control you have only one choice. One, the reports
>> need
>> to be in their own project. Two, they have to be deployed to a server in
>> order to test your links.
>> As far as invoking the reports, it confuses me. You stated that you are
>> using the IE control. The only way to use this control is doing URL
>> integration. All you are doing is assembling a string and setting the URL
>> property for the control.
>> I guess in a convoluted way you could use web services, stream the html
>> to a
>> file and give the IE control a
>> If you are using VS.Net 2005 then look at the new controls. There is a
>> winform and webform controls. The new winform control is a much better
>> way
>> of integrating reports (I am using it in a Winform application. I use IE
>> control in a In-Touch application... real time control user interface).
>> --
>> Bruce Loehle-Conger
>> MVP SQL Server Reporting Services
>> "Richard" <Richard@.discussions.microsoft.com> wrote in message
>> news:F4FA857A-45A2-4158-A1ED-C238D66D6CD2@.microsoft.com...
>> > Hi,
>> >
>> > I have a WinForm project in VS .NET and need to incorporate Reporting
>> > Services.
>> > The application will display the reports to the users on a form with an
>> > IE
>> > control.
>> > Is it possible to add the report items to the application project? or
>> > Must I create a separate project of type report and have the reports
>> > there?
>> > How could the reports be invoked by the application?
>> >
>> > Thanks in advance,
>> >
>> > Richard
>>

Tuesday, March 20, 2012

Progromatically choosing yesterday's date as a parameter.

I have a report setup against an analysis service cube. It runs fine. Users
choose a date from the parameter list and then it pulls out the data nicely.
I need to programatically have it select a parameter for yesterday's date.
Somebody suggested setting a default script for the parameter of
=DateTime.Now.AddDays(-1).ToString("MM/dd/yyyy") to choose yesterday's date.
The problem is that my mdx date is in the format [Dimension Name].[All
Time].[Quarter].[Month].[Day] and the calendar that is being used is in the
tax year. (i.e - today, where in the first quarter of 2006)
How can I convert the current date to the appropriate format?
Any help would be greatly appreciated.
Thanks,
MattI have done similar things in the past and I wrote a SQL query that gets the
current date then I use the datepart function to get the parts (i.e quarters)
If you want to reformat the way a part displays I put the datepart inside a
CASE statement.
Another approach is to turn it into a string and use the datepart to get
the parts you want. It may look something like this.....
SELECT 'Q' + CAST(DATEPART(qq, GETDATE()) AS varchar(255)) AS Quarter
There is probably a better way to do this but this is how I did it.
"Matt" wrote:
> I have a report setup against an analysis service cube. It runs fine. Users
> choose a date from the parameter list and then it pulls out the data nicely.
> I need to programatically have it select a parameter for yesterday's date.
> Somebody suggested setting a default script for the parameter of
> =DateTime.Now.AddDays(-1).ToString("MM/dd/yyyy") to choose yesterday's date.
> The problem is that my mdx date is in the format [Dimension Name].[All
> Time].[Quarter].[Month].[Day] and the calendar that is being used is in the
> tax year. (i.e - today, where in the first quarter of 2006)
> How can I convert the current date to the appropriate format?
> Any help would be greatly appreciated.
> Thanks,
> Matt

Wednesday, March 7, 2012

Programmatically alter grouping

Hi Everyone:
We are evaluating the SQL Server Reporting Services for use in our
current web project. The users will have the ability to select report
fields that they can group on and filter on, via a web page.
The materials I have read so far have not touched on how one can
programmatically alter groups on a report and also how should the
report that offers several grouping options to the user be designed(as
in whether the report should have all possible groupings defined at
design time and "disabled" by default)?
In Crystal Report we remember creating the various goups and
"deactivating" them at design time and programmatically altering the
group hierarchy at run time.
If anyone has any information on this issue, it would be very much
appreciated. Thanks a lot.
-Raghu.http://blogs.msdn.com/chrishays/archive/2004/07/15/184646.aspx
--
This post is provided 'AS IS' with no warranties, and confers no rights. All
rights reserved. Some assembly required. Batteries not included. Your
mileage may vary. Objects in mirror may be closer than they appear. No user
serviceable parts inside. Opening cover voids warranty. Keep out of reach of
children under 3.
"Raghu" <raghu_seshadri@.hotmail.com> wrote in message
news:5c2d0972.0407150214.106d400d@.posting.google.com...
> Hi Everyone:
> We are evaluating the SQL Server Reporting Services for use in our
> current web project. The users will have the ability to select report
> fields that they can group on and filter on, via a web page.
> The materials I have read so far have not touched on how one can
> programmatically alter groups on a report and also how should the
> report that offers several grouping options to the user be designed(as
> in whether the report should have all possible groupings defined at
> design time and "disabled" by default)?
> In Crystal Report we remember creating the various goups and
> "deactivating" them at design time and programmatically altering the
> group hierarchy at run time.
> If anyone has any information on this issue, it would be very much
> appreciated. Thanks a lot.
> -Raghu.|||Your blog made an interesting reading. I will give this technique a
try. Thank you very much for your assistance.
Regards,
Raghu.|||Hi Chris:
I tried the grouping technique explained in your blog. It worked like
a charm. Thanks a lot for your help.
Regards,
Raghu.

Saturday, February 25, 2012

Programmatic inspection of a dump?

I need to set up a job to allow users to restore their databases, on SQL Server 2000 SP3. The idea is that a user inserts a record into a table, identifying the dump they want to load. (They can only restore their own account.) A job picks up this record, restores the database, and notifies the user as appropriate.

My part of this is writing the procedure that the job executes, including the dump restore. Part of that is getting each dump's file groups (data, index, and log) into the proper locations for this server and this user.

Essentially, I need to be able to access the results of 'load filelistonly' from a cursor. How do I access the file list?Essentially, I need to be able to access the results of 'load filelistonly' from a cursor. How do I access the file list?
Google is your friend. http://www.karaszi.com/sqlserver/util_restore_all_in_file.asp|||Man .. its better if you do not call the backup a dump (You know what I mean !!!)... coz its what will save your A$$ when the database goes down ...

Programatically stop a query in C#?

How can I do this so that if the user hits a cancel button, I can issue a SQ
L
command to stop the query execution for that users' session ?. Ive
configured the connection by default for a 90 sec time out, but they can
still navigate other places leaving the query to run the full 90 secs when i
t
doesnt need to if they leave. Thats just a wate of SQL cpu time.
--
JP
.NET Software DevelperI should mention that this is a web app and not a client app in C#. If the
cancel button reside on a page that is already rendered, how will I tell the
running process which process to cancel. I wouldnt think I could use
SqlCommand.Cancel b/c this is user initiated either dorectly or indirectly
from a web page.
--
JP
.NET Software Develper
"JP" wrote:

> How can I do this so that if the user hits a cancel button, I can issue a
SQL
> command to stop the query execution for that users' session ?. Ive
> configured the connection by default for a 90 sec time out, but they can
> still navigate other places leaving the query to run the full 90 secs when
it
> doesnt need to if they leave. Thats just a wate of SQL cpu time.
> --
> JP
> .NET Software Develper

Monday, February 20, 2012

Programatically Creating Report In PDF Format

My users have a lot of reports that they need to generate and save in PDF
format. Each report is the same, except using different parameters.
What I'd like to do is programatically generate a bunch of PDF report files
to a folder on the network, each one using just a different set of parameters.
I have successfully generated a report using the URL:
http://localhost/reportserver?/Profit%20And%20Loss%20Report&Company=0&JobCode=757375&CustomerGroup=&rs:Command=Render&rs:Format=PDF&rc:OutputFormat=PDF
This pops up a Save As... dialog box, prompting the user for a path and
file name. I'd like to control and set the path file name programatically to
automatically generate all the report permutations by passing different
parameters.
Is the URL method the right approach? Any advice would be appreciated, or at
least point me in the right direction so I can research the actual mechanics
of doing this.
Thanks!!!I think what you want can be accomplished using the Subscription feature of
Reporting Services. You can specify a subscription with the "Report Server
File Share" delivery method in order to save PDFs to a folder on the network
on a specified schedule. You can also set up a shared schedule so all the
subscriptions run at the same time.
- Byron
"Smit-Dog" wrote:
> My users have a lot of reports that they need to generate and save in PDF
> format. Each report is the same, except using different parameters.
> What I'd like to do is programatically generate a bunch of PDF report files
> to a folder on the network, each one using just a different set of parameters.
> I have successfully generated a report using the URL:
> http://localhost/reportserver?/Profit%20And%20Loss%20Report&Company=0&JobCode=757375&CustomerGroup=&rs:Command=Render&rs:Format=PDF&rc:OutputFormat=PDF
> This pops up a Save As... dialog box, prompting the user for a path and
> file name. I'd like to control and set the path file name programatically to
> automatically generate all the report permutations by passing different
> parameters.
> Is the URL method the right approach? Any advice would be appreciated, or at
> least point me in the right direction so I can research the actual mechanics
> of doing this.
> Thanks!!!|||Thanks for the reply Bryon.
The only problem with setup up report subscriptions is that there are about
5 different parameters for the report, and basically I need to cycle through
dozens and dozens of possible parameter values for each parameter. And the
values are database driven, so they will change over time.
I'd like to programatically query the database for a list of valid parameter
values, then loop through the parameters list and generate all the PDF
reports with the proper syntax.
I'm guessing that I can do this from VB or .NET by accessing the SRS web
service interface. I just can't seem to find or understand the documentation
for doing this. Any example code would be great.
Thanks...
"Byron" wrote:
> I think what you want can be accomplished using the Subscription feature of
> Reporting Services. You can specify a subscription with the "Report Server
> File Share" delivery method in order to save PDFs to a folder on the network
> on a specified schedule. You can also set up a shared schedule so all the
> subscriptions run at the same time.
> - Byron
> "Smit-Dog" wrote:
> > My users have a lot of reports that they need to generate and save in PDF
> > format. Each report is the same, except using different parameters.
> >
> > What I'd like to do is programatically generate a bunch of PDF report files
> > to a folder on the network, each one using just a different set of parameters.
> >
> > I have successfully generated a report using the URL:
> >
> > http://localhost/reportserver?/Profit%20And%20Loss%20Report&Company=0&JobCode=757375&CustomerGroup=&rs:Command=Render&rs:Format=PDF&rc:OutputFormat=PDF
> >
> > This pops up a Save As... dialog box, prompting the user for a path and
> > file name. I'd like to control and set the path file name programatically to
> > automatically generate all the report permutations by passing different
> > parameters.
> >
> > Is the URL method the right approach? Any advice would be appreciated, or at
> > least point me in the right direction so I can research the actual mechanics
> > of doing this.
> >
> > Thanks!!!|||programmatically...
you mean something like this? I think this is right.
warnings = rs.CreateReport(asReportName, "/", True,
reportDefinition, Nothing)
If Not (warnings Is Nothing) Then
Dim warning As ReportService.Warning
For Each warning In warnings
lblMsg.Text = warning.Message
Next warning
Else
lblMsg.Text = "Report: {0} created successfully with no
warnings"
End If
result = rs.Render(reportName, "PDF", historyID, devInfo,
parameters, credentials, showHideToggle, encoding, mimeType,
reportHistoryParameters, warnings, streamIDs)
sh.SessionId = rs.SessionHeaderValue.SessionId
lblMsg.Text = "SessionID after call to Render: {0}" &
rs.SessionHeaderValue.SessionId
lblMsg.Text = "Execution date and time: {0}" &
rs.SessionHeaderValue.ExecutionDateTime
lblMsg.Text = "Is new execution: {0}" &
rs.SessionHeaderValue.IsNewExecution
' Write the contents of the report to an pdf file.
Try
' Dim stream As FileStream = File.Create("C:\" &
asReportName & ".pdf", result.Length)
Console.WriteLine("File created.")
stream.Write(result, 0, result.Length)
Console.WriteLine("Result written to the file.")
stream.Close()
Catch ex As Exception
lblMsg.Text = ex.Message
GoTo Exit_Sub
End Try
--
Message posted via http://www.sqlmonster.com

Programatically Backup and Restore User Logins Problem...

I'm sure your all aware of the bug in SQL 2000 where if you take a backup an
d
then do a restore on a different database server, the users accounts are not
added to the server's own security (login) section.
The user accounts are though added properly to the databases "users" list
however. And yes I do need to use SQL Server authentication, instead of
windows authentication.
Does anybody know how to get around this' I wish to do it programatically
without enterprise manager.Well I wouldnpt call it a bug, remember that the users, which are specific t
o
the database, map to logins, which are server-based... So whn you restore a
database on a different server than where the backup was made, there is no
way for the softwae to know which login on the other server the dataabse use
r
should be mapped to... If you're lucky enough that the server Login list is
identical on the other server including Login IDs, (pure coincidence) it
actually does fix things up properly, but this is rare.
So you need to use a system-level Stored proc called sp_adduser, this can be
called programatiicaly.
"David Dolheguy" wrote:

> I'm sure your all aware of the bug in SQL 2000 where if you take a backup
and
> then do a restore on a different database server, the users accounts are n
ot
> added to the server's own security (login) section.
> The user accounts are though added properly to the databases "users" list
> however. And yes I do need to use SQL Server authentication, instead of
> windows authentication.
> Does anybody know how to get around this' I wish to do it programaticall
y
> without enterprise manager.
>|||This is not a bug at all. Logins are at the Server level and Users are at
the DB level. When you backup and restore a db it knows nothing of the
server. These might help:
http://vyaskn.tripod.com/moving_sql_server.htm Moving DBs
http://www.databasejournal.com/feat...cle.php/3379901 Moving
system DB's
http://www.support.microsoft.com/?id=314546 Moving DB's between Servers
http://www.support.microsoft.com/?id=224071 Moving SQL Server Databases
to a New Location with Detach/Attach
http://support.microsoft.com/?id=221465 Using WITH MOVE in a
Restore
http://www.support.microsoft.com/?id=246133 How To Transfer Logins and
Passwords Between SQL Servers
http://www.support.microsoft.com/?id=298897 Mapping Logins & SIDs after a
Restore
http://www.dbmaint.com/SyncSqlLogins.asp Utility to map logins to
users
http://www.support.microsoft.com/?id=168001 User Logon and/or Permission
Errors After Restoring Dump
http://www.support.microsoft.com/?id=240872 How to Resolve Permission
Issues When a Database Is Moved Between SQL
Andrew J. Kelly SQL MVP
"David Dolheguy" <DavidDolheguy@.discussions.microsoft.com> wrote in message
news:5C877C2E-EE7D-4658-9E31-AF46F0060E18@.microsoft.com...
> I'm sure your all aware of the bug in SQL 2000 where if you take a backup
> and
> then do a restore on a different database server, the users accounts are
> not
> added to the server's own security (login) section.
> The user accounts are though added properly to the databases "users" list
> however. And yes I do need to use SQL Server authentication, instead of
> windows authentication.
> Does anybody know how to get around this' I wish to do it
> programatically
> without enterprise manager.
>