Showing posts with label automatically. Show all posts
Showing posts with label automatically. Show all posts

Monday, March 26, 2012

Exec procedure on database create/rename/delete ?

Hello,

I need to execute certain procedures automatically when databases are create, renamed or deleted. I looked around in this forum and Internet but couldn't find anything. This is for SQL 2000.

Well, in SQL 2000 it's not as easy as in SQL 2005 where you could use DDL triggers to achieve this.

You could configure different Alerts in SQL Server 2000 to fire when certain messages are logged to the error log, in this case you could try possibly firing an alert when the error message # 1805 fires ("The CREATE DATABASE process is allocating 1.00 MB on disk 'blah'), but that would only capture newly created DBs. You could use the same method for databases that are attached, restored, deleted, etc., you'd just have to be sure to get error messages that are fired for each 'event'. Once you have the appropriate Alert configured, just set the alert to execute a SQL Agent job when it fires, and setup the Agent job to run the SQL code you want.

If you don't need the code to run exactly when the DB is created/deleted/attached/etc., you could run a trace that captures the appropriate events, then load the trace file nightly and scan for the appropriate event classes, then executing code appropriately as needed.

HTH,

|||

Thanks a lot Chad. This is very helpful. I didn't think about alerts.

sql

Wednesday, March 21, 2012

Exclusive access could not be obtained because the database is in use.

I have a test database that is automatically restored from the live database each day at 2:30AM. I recently started receiving this message:

Exclusive access could not be obtained because the database is in use.

and the restore is not able to occur.

Any ideas on how I can prevent this from happening?

You can't restore a db when it is in use, meaning that there are connections open to the database. Somehow, somewhere, connections are being left open to your database. Before you leave for the day, run the following:

exec sp_who

This will tell you who (username and machine name) has an open connection to the database.

Sunday, February 19, 2012

Excel report - stop text from wrapping

How do I stop text from wrapping within a cell?
or
How do I make a cell automatically grow horizontally and not vertically?On Mar 14, 5:43 am, JRMalherbe <JRMalhe...@.discussions.microsoft.com>
wrote:
> How do I stop text from wrapping within a cell?
> or
> How do I make a cell automatically grow horizontally and not vertically?
As far as I can tell, this functionality (automatic horizontal growth)
does not exist in Reporting Services. To not allow cell/text wrapping,
you would remove the selection of 'Can increase to accommodate
contents' on the Format tab of the Textbox Properties (below Textbox
height). Sorry I could not be of greater assistance.
Regards,
Enrique Martinez
Sr. SQL Server Developer|||That is correct.
The RDL CanGrow property only works in the vertical direction. Setting this
to false will disable this functionality.
"EMartinez" wrote:
> On Mar 14, 5:43 am, JRMalherbe <JRMalhe...@.discussions.microsoft.com>
> wrote:
> > How do I stop text from wrapping within a cell?
> > or
> > How do I make a cell automatically grow horizontally and not vertically?
> As far as I can tell, this functionality (automatic horizontal growth)
> does not exist in Reporting Services. To not allow cell/text wrapping,
> you would remove the selection of 'Can increase to accommodate
> contents' on the Format tab of the Textbox Properties (below Textbox
> height). Sorry I could not be of greater assistance.
> Regards,
> Enrique Martinez
> Sr. SQL Server Developer
>|||My report uses a table to display the data in.
Even though all the cells is set to CanGrow=False the cells will expand
vertically and the text will wrap.
For me it seems that the CanGrow=False has no effect at all.
Is it just me or did I miss something somewhere?
"Bruce Johnson [MSFT]" wrote:
> That is correct.
> The RDL CanGrow property only works in the vertical direction. Setting this
> to false will disable this functionality.
>
>
> "EMartinez" wrote:
> > On Mar 14, 5:43 am, JRMalherbe <JRMalhe...@.discussions.microsoft.com>
> > wrote:
> > > How do I stop text from wrapping within a cell?
> > > or
> > > How do I make a cell automatically grow horizontally and not vertically?
> >
> > As far as I can tell, this functionality (automatic horizontal growth)
> > does not exist in Reporting Services. To not allow cell/text wrapping,
> > you would remove the selection of 'Can increase to accommodate
> > contents' on the Format tab of the Textbox Properties (below Textbox
> > height). Sorry I could not be of greater assistance.
> >
> > Regards,
> >
> > Enrique Martinez
> > Sr. SQL Server Developer
> >
> >

Friday, February 17, 2012

Excel renderer in RS2005-Sheet names

The Reporting group in our company uses SRS 2005 to generate most reports for
the Company. Many of these reports are distributed automatically to our
clients. An increasing number of these reports are distributed as Excel
spreadsheets. These Excel reports generally contain multiple worksheets.
For customer convenience, these worksheets should be named. The portion of
Report Services that writes the Excel files, is apparently not capable of
naming these worksheets with user specified names when there are multiple
worksheets. However when only one worksheet is present, it is named with the
title of the report. Is there a way to name the worksheets dynamically as the
report is generated? If not, is it possible to write a custom renderer to do
so, or to extend the excel renderer? I appreciate any code examples.
Thanks in advance.You might want to look into Software Artisan's Excel writer for Reporting
Services. It gives you more control over the Excel rendering.
http://officewriter.softartisans.com/officewriter-250.aspx
--
Andy Potter
blog : http://sqlreportingservices.spaces.live.com
info@.(NOSPAM)lakeclaireenterprises.com
"Saritha" <Saritha@.discussions.microsoft.com> wrote in message
news:1BD099C8-6EA3-4D9B-999D-5574F9A151E6@.microsoft.com...
> The Reporting group in our company uses SRS 2005 to generate most reports
> for
> the Company. Many of these reports are distributed automatically to our
> clients. An increasing number of these reports are distributed as Excel
> spreadsheets. These Excel reports generally contain multiple worksheets.
> For customer convenience, these worksheets should be named. The portion of
> Report Services that writes the Excel files, is apparently not capable of
> naming these worksheets with user specified names when there are multiple
> worksheets. However when only one worksheet is present, it is named with
> the
> title of the report. Is there a way to name the worksheets dynamically as
> the
> report is generated? If not, is it possible to write a custom renderer to
> do
> so, or to extend the excel renderer? I appreciate any code examples.
> Thanks in advance.
>