Showing posts with label view. Show all posts
Showing posts with label view. Show all posts

Friday, March 30, 2012

Maintenance Plan File Deletion Bug

I have a maintenance plan set to delete files after 1 week. Instead it is deleting everthing older then 1 day. When I view the tsql in the designer, the xp_delete_file string looks correct. Is there anyway to see the exact xp_delete_file string that is actually being executed at run time?

I found the problem.

There is an "off by one" bug using the time unit of measure in "Maintenance" and "Cleanup" tasks.

If you select "Weeks" you get "Days", with "Days" you get "Hours", and "Hours" blows the index.

The patching procedure is a little complicated. Read this:

http://blogs.msdn.com/psssql/archive/2007/04/06/post-sql-server-2005-service-pack-2-sp2-fixes-explained.aspx

What service pack you are on?

There were maintenane related bugs in SP2 so that MS released hot fix on 03/05/2007.

Check the hot fix if you are already on SP2 applied before the hot fix release. If you are on SP1 apply the SP2 down loaded after 03/06/2007 which is hot fix included.

|||

I found out what the problem is.

There is an "off by one" bug where the wrong time unit of measure is being used.

"Hours" are being converted to "Days", Days" are being converted to "Hours", and "Hours" will blow with an invalid index.

This problem exists for "Maintenance Cleanup" tasks and "Clean Up History" tasks.

The fix is a little complicated because there are two versions of sp2 out there.

Read this to figure out the proper fix:

http://blogs.msdn.com/psssql/archive/2007/04/06/post-sql-server-2005-service-pack-2-sp2-fixes-explained.aspx

Monday, March 19, 2012

Maintaining partitioned views

Hello,

I have a large set of data that I have set up as a partitioned view.
The view is partitioned by a datetime column and the individual tables
each represent one month's worth of data. I need to keep at least two
year's worth of data at all times, but after two years I can archive
the data. A sample of the code used is below. It is simplified for
space reasons.

My question is, how do other people maintain the database in this type
of scenario? I could create all of the tables necessary for the next
year and then go through that at the end of each year (archive tables
over two years, add new tables, and change the view), but I was also
thinking that I might be able to write a stored procedure that runs
once a month and does all three of those tasks automatically. It seems
like a lot of dynamic SQL code though for something like that.
Alternatively, I could write VB code to handle it in a DTS package.
So, my question again is, how are others doing it? Any suggestions?

Thanks!
-Tom.

CREATE TABLE [dbo].[Station_Events_200401] (
[event_time] [datetime] NOT NULL ,
[another_column] [char] (8) NOT NULL )
GO

CREATE TABLE [dbo].[Station_Events_200402] (
[event_time] [datetime] NOT NULL ,
[another_column] [char] (8) NOT NULL )
GO

CREATE VIEW Station_Events
AS
SELECT event_time,
another_column
FROM Station_Events_200401
UNION ALL
SELECT event_time,
another_column
FROM Station_Events_200402
GO"Thomas R. Hummel" <tom_hummel@.hotmail.com> wrote in message
news:a2c0eeb8.0402060727.55312a15@.posting.google.c om...
> Hello,
> I have a large set of data that I have set up as a partitioned view.
> The view is partitioned by a datetime column and the individual tables
> each represent one month's worth of data. I need to keep at least two
> year's worth of data at all times, but after two years I can archive
> the data. A sample of the code used is below. It is simplified for
> space reasons.
> My question is, how do other people maintain the database in this type
> of scenario? I could create all of the tables necessary for the next
> year and then go through that at the end of each year (archive tables
> over two years, add new tables, and change the view), but I was also
> thinking that I might be able to write a stored procedure that runs
> once a month and does all three of those tasks automatically. It seems
> like a lot of dynamic SQL code though for something like that.
> Alternatively, I could write VB code to handle it in a DTS package.
> So, my question again is, how are others doing it? Any suggestions?
> Thanks!
> -Tom.
> CREATE TABLE [dbo].[Station_Events_200401] (
> [event_time] [datetime] NOT NULL ,
> [another_column] [char] (8) NOT NULL )
> GO
> CREATE TABLE [dbo].[Station_Events_200402] (
> [event_time] [datetime] NOT NULL ,
> [another_column] [char] (8) NOT NULL )
> GO
> CREATE VIEW Station_Events
> AS
> SELECT event_time,
> another_column
> FROM Station_Events_200401
> UNION ALL
> SELECT event_time,
> another_column
> FROM Station_Events_200402
> GO

I would use a DTS package - the first steps to create the objects
dynamically, then later steps to call stored procedures to actually move the
data. But that's more or less a personal preference, and you could do
everything in a stored procedure as well. Assuming there are no major
reasons to use one solution or another, it probably depends on what is most
transparent and easiest to maintain for you and your organization.

Simon|||Without dynamic SQL the view will be a problem, but I think you can easily
handle the archiving.

Within a stored procedure you can create a new copy of your table "template"
like this:

CREATE TABLE [dbo].[Station_Events_Template] ( [event_time] [datetime] NOT
NULL , [another_column] [char] (8) NOT NULL )

Then insert the rows into this table for the appropriate time period.

INSERT INTO Station_Events_Template
SELECT * FROM [your "active" table] WHERE event_time BETWEEN @.thisdate AND
@.thatdate

After the insert you can rename the template using the sp_rename procedure.
You will need a variable for the new table name first:
DECLARE @.NewName varchar(25)

SELECT @.NewName = 'Station_Events_' + CONVERT(char(6), @.MonthEndDate,
112) -- returns date in format "YYYYMM"

EXEC sp_rename 'Station_Events_Template', @.NewName

Hope this is helpful.

"Thomas R. Hummel" <tom_hummel@.hotmail.com> wrote in message
news:a2c0eeb8.0402060727.55312a15@.posting.google.c om...
> Hello,
> I have a large set of data that I have set up as a partitioned view.
> The view is partitioned by a datetime column and the individual tables
> each represent one month's worth of data. I need to keep at least two
> year's worth of data at all times, but after two years I can archive
> the data. A sample of the code used is below. It is simplified for
> space reasons.
> My question is, how do other people maintain the database in this type
> of scenario? I could create all of the tables necessary for the next
> year and then go through that at the end of each year (archive tables
> over two years, add new tables, and change the view), but I was also
> thinking that I might be able to write a stored procedure that runs
> once a month and does all three of those tasks automatically. It seems
> like a lot of dynamic SQL code though for something like that.
> Alternatively, I could write VB code to handle it in a DTS package.
> So, my question again is, how are others doing it? Any suggestions?
> Thanks!
> -Tom.
> CREATE TABLE [dbo].[Station_Events_200401] (
> [event_time] [datetime] NOT NULL ,
> [another_column] [char] (8) NOT NULL )
> GO
> CREATE TABLE [dbo].[Station_Events_200402] (
> [event_time] [datetime] NOT NULL ,
> [another_column] [char] (8) NOT NULL )
> GO
> CREATE VIEW Station_Events
> AS
> SELECT event_time,
> another_column
> FROM Station_Events_200401
> UNION ALL
> SELECT event_time,
> another_column
> FROM Station_Events_200402
> GO|||Thank you both for your suggestions! I always seem to overlook using
sp_rename as part of my bag of tricks. I'll give that some
consideration, but right now I'm leaning towards a DTS package using
VB to generate the SQL code.

Thanks,
-Tom.

Maintain separate table via trigger vs. indexed view

Hello,
I have a table LargeTable in many columns and many rows. However, I also
need to have a small subset of the rows in LargeTable and only data from
small set of columns; call it SmallTable.
SmallTable gets read very often. So basically I've been using trigger on
LargeTable to watch for any change there to populate the SmallTable.
However, I realized that an indexed view can replace SmallTable.
In general, which one would be a better design in term of performance? I
know that indexed view can be more elegant but I'm interested in
performance. thanks!"Zester" <zeze@.nottospam.com> wrote in message
news:OaN3Tf3BIHA.5360@.TK2MSFTNGP03.phx.gbl...
> Hello,
> I have a table LargeTable in many columns and many rows. However, I also
> need to have a small subset of the rows in LargeTable and only data from
> small set of columns; call it SmallTable.
> SmallTable gets read very often. So basically I've been using trigger on
> LargeTable to watch for any change there to populate the SmallTable.
> However, I realized that an indexed view can replace SmallTable.
> In general, which one would be a better design in term of performance? I
> know that indexed view can be more elegant but I'm interested in
> performance. thanks!
>
>
What makes you think this is a candidate for an indexed view? You could
create an ordinary view and put a relevant nonclustered index on the base
table. That way you won't incur the same write overhead that an indexed view
has. In SQL Server 2005 you can also include non-key columns in a
nonclustered index.
--
David Portas|||the LargeTable gets read even more often than the SmallTable and LargeTable
serves the main feature of our product. Writing to it is not often but does
occur - most likely only to the columns that have nothing to do with the
dataset needed for SmallTable. The feature using SmallTable is minor, so we
don't want it to interfere with the main feature that needs LargeTable.
"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
news:uKBFF$3BIHA.3564@.TK2MSFTNGP04.phx.gbl...
> "Zester" <zeze@.nottospam.com> wrote in message
> news:OaN3Tf3BIHA.5360@.TK2MSFTNGP03.phx.gbl...
>> Hello,
>> I have a table LargeTable in many columns and many rows. However, I also
>> need to have a small subset of the rows in LargeTable and only data from
>> small set of columns; call it SmallTable.
>> SmallTable gets read very often. So basically I've been using trigger on
>> LargeTable to watch for any change there to populate the SmallTable.
>> However, I realized that an indexed view can replace SmallTable.
>> In general, which one would be a better design in term of performance? I
>> know that indexed view can be more elegant but I'm interested in
>> performance. thanks!
>>
> What makes you think this is a candidate for an indexed view? You could
> create an ordinary view and put a relevant nonclustered index on the base
> table. That way you won't incur the same write overhead that an indexed
> view has. In SQL Server 2005 you can also include non-key columns in a
> nonclustered index.
> --
> David Portas
>

Maintain Report State

I have a matrix report where the user can drill down into a hierarchy to view
data for a particular product. The report also includes a parameter list
allowing the user to change the selected product.
The problem with this approach is that the user may drill to a specific
branch and then decide to switch products. At that point the report refreshes
and collapses back to the root node, because I have defined the report to
hide all groups on first entry.
Given that I am using Report Manager with no custom front end, does anyone
know of a good strategy to maintain state so that I can retain which groups
are expanded and collapsed for a particular user between instances of the
report?Modifying the Report Parameter causes the query to be executed. When this
happens the report is rendered from scratch. Hence you will not be able to
maintain the state of how the groups are displayed.
--
Bruce Johnson [MSFT]
Microsoft SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Dave Morrow" <DaveMorrow@.discussions.microsoft.com> wrote in message
news:413E2C03-1362-4130-A16B-F7E371D2E0F3@.microsoft.com...
>I have a matrix report where the user can drill down into a hierarchy to
>view
> data for a particular product. The report also includes a parameter list
> allowing the user to change the selected product.
> The problem with this approach is that the user may drill to a specific
> branch and then decide to switch products. At that point the report
> refreshes
> and collapses back to the root node, because I have defined the report to
> hide all groups on first entry.
> Given that I am using Report Manager with no custom front end, does anyone
> know of a good strategy to maintain state so that I can retain which
> groups
> are expanded and collapsed for a particular user between instances of the
> report?

Maintain Jobs, View Logs

I have a user who needs to check whether 2 jobs have run on a SQL Server 200
0 instance, and be able to view logs.
Is there a way of doing this, and not allowing them access to anything else?Hi
Does the use have EM on his/her workstation?
Does the user have permissions to run the job?
See this example written by Neil
/*** Scheduled task reporter for SQL 2000
**** Copyright Neil Boyle 2003.
**** Use entirely at your own risk
***/
use MSDB
go
select convert(varchar(22), j.name) as job_name
, case freq_type -- Daily, weekly, Monthly
when 1 then 'Once'
when 4 then 'Daily'
when 8 then 'Wk ' -- For weekly, add in the days of the week
+ case freq_interval & 2 when 2 then 'M' else '' end -- Monday
+ case freq_interval & 4 when 4 then 'Tu' else '' end -- Tuesday
+ case freq_interval & 8 when 8 then 'W' else '' end -- etc
+ case freq_interval & 16 when 16 then 'Th' else '' end
+ case freq_interval & 32 when 32 then 'F' else '' end
+ case freq_interval & 64 when 64 then 'Sa' else '' end
+ case freq_interval & 1 when 1 then 'Su' else '' end
when 16 then 'Mthly on day ' + convert(varchar(2), freq_interval) --
Monthly on a particular day
when 32 then 'Mthly ' -- The most complicated one, "every third Friday
of the month" for example
+ case freq_relative_interval
when 1 then 'Every First '
when 2 then 'Every Second '
when 4 then 'Every Third '
when 8 then 'Every Fourth '
when 16 then 'Every Last '
end
+ case freq_interval
when 1 then 'Sunday'
when 2 then 'Monday'
when 3 then 'Tuesday'
when 4 then 'Wednesday'
when 5 then 'Thursday'
when 6 then 'Friday'
when 7 then 'Saturday'
when 8 then 'Day'
when 9 then 'Week day'
when 10 then 'Weekend day'
end
when 64 then 'Startup' -- When SQL Server starts
when 128 then 'Idle' -- Whenever SQL Server gets bored
else 'Err' -- This should never happen
end as schedule
, case freq_subday_type -- FOr when a job funs every few seconds, minutes
or hours
when 1 then 'Runs once at:'
when 2 then 'every ' + convert(varchar(3), freq_subday_interval) + '
seconds'
when 4 then 'every ' + convert(varchar(3), freq_subday_interval) + '
minutes'
when 8 then 'every ' + convert(varchar(3), freq_subday_interval) + '
hours'
end as frequency
-- All the subsrings are because the times are stored as an integer with no
leading zeroes
-- i.e. 0 means midnight, 13000 means half past one in the morning
(01:30:00)
, substring (right (stuff (' ', 1, 1, '000000') +
convert(varchar(6),active_start_time), 6), 1, 2)
+ ':'
+ substring (
right (stuff (' ', 1, 1, '000000') + convert(varchar(6),
active_start_time), 6) ,3 ,2)
+ ':'
+ substring (
right (stuff (' ', 1, 1, '000000') + convert(varchar(6),active_start_time),
6) ,5 ,2) as start_at
,case freq_subday_type
when 1 then NULL -- Ignore the end time if not a recurring job
else substring (right (stuff (' ', 1, 1, '000000') + convert(varchar(6),
active_end_time), 6), 1, 2)
+ ':'
+ substring (
right (stuff (' ', 1, 1, '000000') + convert(varchar(6), active_end_time),
6) ,3 ,2)
+ ':'
+ substring (
right (stuff (' ', 1, 1, '000000') + convert(varchar(6), active_end_time),
6) ,5 ,2) end as end_at
from sysjobs j
join sysJobSchedules s
on j.job_id = s.job_id
order by j.name, start_at
"JamesNZ" <JamesNZ.24lo0y@.mail.webservertalk.com> wrote in message
news:JamesNZ.24lo0y@.mail.webservertalk.com...
> I have a user who needs to check whether 2 jobs have run on a SQL Server
> 2000 instance, and be able to view logs.
> Is there a way of doing this, and not allowing them access to anything
> else?
>
> --
> JamesNZ
> ---
> Posted via http://www.webservertalk.com
> ---
> View this thread: http://www.webservertalk.com/message1430463.html
>|||Here is one solution which should work for you:
1. Create a SP using the following script. Just mention your job names in
the following line of the script:
--sj.name in ('Job1', 'Job2') and
CREATE PROCEDURE dbo.read_jobhistory
as
select sjh.server, sj.name, case sjh.run_status
when 0 then 'Failed'
when 1 then 'Succeeded'
when 2 then 'Retry'
when 3 then 'Canceled'
when 4 then 'In progress'
end as 'Job Status',
sjh.sql_message_id, sjh.sql_severity,sjh.message,
convert(datetime, cast (sjh.run_date as char(8)) + ' ' +
left(right('000000' + cast (sjh.run_time as varchar(6)),6),2) + ':' +
substring(right('000000' + cast (sjh.run_time as varchar(6)),6),3,2) + ':' +
right('000000' + cast (sjh.run_time as varchar(6)),2))as 'Run Date',
sjh.run_duration, sjh.operator_id_emailed,
sjh.operator_id_netsent, sjh.operator_id_paged, sjh.retries_attempted
from
msdb..sysjobhistory sjh
join msdb..sysjobs sj
on sjh.job_id = sj.job_id
where
sj.name in ('Job1', 'Job2') and
step_id = 0
and sjh.run_date >= convert(char(10),getdate(),112)
order by sjh.server, sj.name, sjh.run_date, sjh.run_time
2. Grant Execution on this SP to the concerned user.
3. The concerned user can get the report for the today's date just by
executing the SP.
"JamesNZ" wrote:

> I have a user who needs to check whether 2 jobs have run on a SQL Server
> 2000 instance, and be able to view logs.
> Is there a way of doing this, and not allowing them access to anything
> else?

Maintain Jobs, View Logs

I have a user who needs to check whether 2 jobs have run on a SQL Server
2000 instance, and be able to view logs.
Is there a way of doing this, and not allowing them access to anything
else?
--
JamesNZ
---
Posted via http://www.webservertalk.com
---
View this thread: http://www.webservertalk.com/message1430463.htmlHi
Does the use have EM on his/her workstation?
Does the user have permissions to run the job?
See this example written by Neil
/*** Scheduled task reporter for SQL 2000
**** Copyright Neil Boyle 2003.
**** Use entirely at your own risk
***/
use MSDB
go
select convert(varchar(22), j.name) as job_name
, case freq_type -- Daily, weekly, Monthly
when 1 then 'Once'
when 4 then 'Daily'
when 8 then 'Wk ' -- For weekly, add in the days of the week
+ case freq_interval & 2 when 2 then 'M' else '' end -- Monday
+ case freq_interval & 4 when 4 then 'Tu' else '' end -- Tuesday
+ case freq_interval & 8 when 8 then 'W' else '' end -- etc
+ case freq_interval & 16 when 16 then 'Th' else '' end
+ case freq_interval & 32 when 32 then 'F' else '' end
+ case freq_interval & 64 when 64 then 'Sa' else '' end
+ case freq_interval & 1 when 1 then 'Su' else '' end
when 16 then 'Mthly on day ' + convert(varchar(2), freq_interval) --
Monthly on a particular day
when 32 then 'Mthly ' -- The most complicated one, "every third Friday
of the month" for example
+ case freq_relative_interval
when 1 then 'Every First '
when 2 then 'Every Second '
when 4 then 'Every Third '
when 8 then 'Every Fourth '
when 16 then 'Every Last '
end
+ case freq_interval
when 1 then 'Sunday'
when 2 then 'Monday'
when 3 then 'Tuesday'
when 4 then 'Wednesday'
when 5 then 'Thursday'
when 6 then 'Friday'
when 7 then 'Saturday'
when 8 then 'Day'
when 9 then 'Week day'
when 10 then 'Weekend day'
end
when 64 then 'Startup' -- When SQL Server starts
when 128 then 'Idle' -- Whenever SQL Server gets bored
else 'Err' -- This should never happen
end as schedule
, case freq_subday_type -- FOr when a job funs every few seconds, minutes
or hours
when 1 then 'Runs once at:'
when 2 then 'every ' + convert(varchar(3), freq_subday_interval) + '
seconds'
when 4 then 'every ' + convert(varchar(3), freq_subday_interval) + '
minutes'
when 8 then 'every ' + convert(varchar(3), freq_subday_interval) + '
hours'
end as frequency
-- All the subsrings are because the times are stored as an integer with no
leading zeroes
-- i.e. 0 means midnight, 13000 means half past one in the morning
(01:30:00)
, substring (right (stuff (' ', 1, 1, '000000') +
convert(varchar(6),active_start_time), 6), 1, 2)
+ ':'
+ substring (
right (stuff (' ', 1, 1, '000000') + convert(varchar(6),
active_start_time), 6) ,3 ,2)
+ ':'
+ substring (
right (stuff (' ', 1, 1, '000000') + convert(varchar(6),active_start_time),
6) ,5 ,2) as start_at
,case freq_subday_type
when 1 then NULL -- Ignore the end time if not a recurring job
else substring (right (stuff (' ', 1, 1, '000000') + convert(varchar(6),
active_end_time), 6), 1, 2)
+ ':'
+ substring (
right (stuff (' ', 1, 1, '000000') + convert(varchar(6), active_end_time),
6) ,3 ,2)
+ ':'
+ substring (
right (stuff (' ', 1, 1, '000000') + convert(varchar(6), active_end_time),
6) ,5 ,2) end as end_at
from sysjobs j
join sysJobSchedules s
on j.job_id = s.job_id
order by j.name, start_at
"JamesNZ" <JamesNZ.24lo0y@.mail.webservertalk.com> wrote in message
news:JamesNZ.24lo0y@.mail.webservertalk.com...
> I have a user who needs to check whether 2 jobs have run on a SQL Server
> 2000 instance, and be able to view logs.
> Is there a way of doing this, and not allowing them access to anything
> else?
>
> --
> JamesNZ
> ---
> Posted via http://www.webservertalk.com
> ---
> View this thread: http://www.webservertalk.com/message1430463.html
>|||Here is one solution which should work for you:
1. Create a SP using the following script. Just mention your job names in
the following line of the script:
--sj.name in ('Job1', 'Job2') and
CREATE PROCEDURE dbo.read_jobhistory
as
select sjh.server, sj.name, case sjh.run_status
when 0 then 'Failed'
when 1 then 'Succeeded'
when 2 then 'Retry'
when 3 then 'Canceled'
when 4 then 'In progress'
end as 'Job Status',
sjh.sql_message_id, sjh.sql_severity,sjh.message,
convert(datetime, cast (sjh.run_date as char(8)) + ' ' +
left(right('000000' + cast (sjh.run_time as varchar(6)),6),2) + ':' +
substring(right('000000' + cast (sjh.run_time as varchar(6)),6),3,2) + ':' +
right('000000' + cast (sjh.run_time as varchar(6)),2))as 'Run Date',
sjh.run_duration, sjh.operator_id_emailed,
sjh.operator_id_netsent, sjh.operator_id_paged, sjh.retries_attempted
from
msdb..sysjobhistory sjh
join msdb..sysjobs sj
on sjh.job_id = sj.job_id
where
sj.name in ('Job1', 'Job2') and
step_id = 0
and sjh.run_date >= convert(char(10),getdate(),112)
order by sjh.server, sj.name, sjh.run_date, sjh.run_time
2. Grant Execution on this SP to the concerned user.
3. The concerned user can get the report for the today's date just by
executing the SP.
"JamesNZ" wrote:
> I have a user who needs to check whether 2 jobs have run on a SQL Server
> 2000 instance, and be able to view logs.
> Is there a way of doing this, and not allowing them access to anything
> else?

Maintain Jobs, View Logs

I have a user who needs to check whether 2 jobs have run on a SQL Server
2000 instance, and be able to view logs.
Is there a way of doing this, and not allowing them access to anything
else?
JamesNZ
Posted via http://www.webservertalk.com
View this thread: http://www.webservertalk.com/message1430463.html
Hi
Does the use have EM on his/her workstation?
Does the user have permissions to run the job?
See this example written by Neil
/*** Scheduled task reporter for SQL 2000
**** Copyright Neil Boyle 2003.
**** Use entirely at your own risk
***/
use MSDB
go
select convert(varchar(22), j.name) as job_name
, case freq_type -- Daily, weekly, Monthly
when 1 then 'Once'
when 4 then 'Daily'
when 8 then 'Wk ' -- For weekly, add in the days of the week
+ case freq_interval & 2 when 2 then 'M' else '' end -- Monday
+ case freq_interval & 4 when 4 then 'Tu' else '' end -- Tuesday
+ case freq_interval & 8 when 8 then 'W' else '' end -- etc
+ case freq_interval & 16 when 16 then 'Th' else '' end
+ case freq_interval & 32 when 32 then 'F' else '' end
+ case freq_interval & 64 when 64 then 'Sa' else '' end
+ case freq_interval & 1 when 1 then 'Su' else '' end
when 16 then 'Mthly on day ' + convert(varchar(2), freq_interval) --
Monthly on a particular day
when 32 then 'Mthly ' -- The most complicated one, "every third Friday
of the month" for example
+ case freq_relative_interval
when 1 then 'Every First '
when 2 then 'Every Second '
when 4 then 'Every Third '
when 8 then 'Every Fourth '
when 16 then 'Every Last '
end
+ case freq_interval
when 1 then 'Sunday'
when 2 then 'Monday'
when 3 then 'Tuesday'
when 4 then 'Wednesday'
when 5 then 'Thursday'
when 6 then 'Friday'
when 7 then 'Saturday'
when 8 then 'Day'
when 9 then 'Week day'
when 10 then 'Weekend day'
end
when 64 then 'Startup' -- When SQL Server starts
when 128 then 'Idle' -- Whenever SQL Server gets bored
else 'Err' -- This should never happen
end as schedule
, case freq_subday_type -- FOr when a job funs every few seconds, minutes
or hours
when 1 then 'Runs once at:'
when 2 then 'every ' + convert(varchar(3), freq_subday_interval) + '
seconds'
when 4 then 'every ' + convert(varchar(3), freq_subday_interval) + '
minutes'
when 8 then 'every ' + convert(varchar(3), freq_subday_interval) + '
hours'
end as frequency
-- All the subsrings are because the times are stored as an integer with no
leading zeroes
-- i.e. 0 means midnight, 13000 means half past one in the morning
(01:30:00)
, substring (right (stuff (' ', 1, 1, '000000') +
convert(varchar(6),active_start_time), 6), 1, 2)
+ ':'
+ substring (
right (stuff (' ', 1, 1, '000000') + convert(varchar(6),
active_start_time), 6) ,3 ,2)
+ ':'
+ substring (
right (stuff (' ', 1, 1, '000000') + convert(varchar(6),active_start_time),
6) ,5 ,2) as start_at
,case freq_subday_type
when 1 then NULL -- Ignore the end time if not a recurring job
else substring (right (stuff (' ', 1, 1, '000000') + convert(varchar(6),
active_end_time), 6), 1, 2)
+ ':'
+ substring (
right (stuff (' ', 1, 1, '000000') + convert(varchar(6), active_end_time),
6) ,3 ,2)
+ ':'
+ substring (
right (stuff (' ', 1, 1, '000000') + convert(varchar(6), active_end_time),
6) ,5 ,2) end as end_at
from sysjobs j
join sysJobSchedules s
on j.job_id = s.job_id
order by j.name, start_at
"JamesNZ" <JamesNZ.24lo0y@.mail.webservertalk.com> wrote in message
news:JamesNZ.24lo0y@.mail.webservertalk.com...
> I have a user who needs to check whether 2 jobs have run on a SQL Server
> 2000 instance, and be able to view logs.
> Is there a way of doing this, and not allowing them access to anything
> else?
>
> --
> JamesNZ
> Posted via http://www.webservertalk.com
> View this thread: http://www.webservertalk.com/message1430463.html
>
|||Here is one solution which should work for you:
1. Create a SP using the following script. Just mention your job names in
the following line of the script:
--sj.name in ('Job1', 'Job2') and
CREATE PROCEDURE dbo.read_jobhistory
as
select sjh.server, sj.name, case sjh.run_status
when 0 then 'Failed'
when 1 then 'Succeeded'
when 2 then 'Retry'
when 3 then 'Canceled'
when 4 then 'In progress'
end as 'Job Status',
sjh.sql_message_id, sjh.sql_severity,sjh.message,
convert(datetime, cast (sjh.run_date as char(8)) + ' ' +
left(right('000000' + cast (sjh.run_time as varchar(6)),6),2) + ':' +
substring(right('000000' + cast (sjh.run_time as varchar(6)),6),3,2) + ':' +
right('000000' + cast (sjh.run_time as varchar(6)),2))as 'Run Date',
sjh.run_duration, sjh.operator_id_emailed,
sjh.operator_id_netsent, sjh.operator_id_paged, sjh.retries_attempted
from
msdb..sysjobhistory sjh
join msdb..sysjobs sj
on sjh.job_id = sj.job_id
where
sj.name in ('Job1', 'Job2') and
step_id = 0
and sjh.run_date >= convert(char(10),getdate(),112)
order by sjh.server, sj.name, sjh.run_date, sjh.run_time
2. Grant Execution on this SP to the concerned user.
3. The concerned user can get the report for the today's date just by
executing the SP.
"JamesNZ" wrote:

> I have a user who needs to check whether 2 jobs have run on a SQL Server
> 2000 instance, and be able to view logs.
> Is there a way of doing this, and not allowing them access to anything
> else?

Saturday, February 25, 2012

Mac/Safari - SQL Server Report, Collapse on left side

Hello,

We are using SQL Server Reporting services in our web application. When we view the report on IE/FF it works normally.
But when we view it on Safari on MAC/Windows the report is collapse towards left. It is not taking the width as provided.
When we view the PDF it shows the normal report.

How can this issue be solved ?

Thanks,
Deepesh Verma

Hi,

In Reporting Services, you use a Web browser to view reports and run Report Manager. Not all report functionality is supported by all browsers. The following table describes report functionality restrictions for the supported browsers.

Browser type

DescriptionMicrosoft Internet Explorer 6.0 or 7.0 for Windows, with all service packs applied and scripting enabled.Internet Explorer is recommended if you want to use all the available report functionality. Although you can use other browsers to view a report, Internet Explorer for Windows is the only browser that is guaranteed to support the complete set of features for working with reports.Netscape 7.2, Mozilla 1.7, Firefox 1.0.3, Safari 1.3, and Safari 2.0The following features are not supported in third-party browsers:· Document map· Searching within the report· Zoom· Fixed table headersThe following additional features are not available when viewing reports in Safari:· The Calendar control that is used to select dates on a parameterized report that runs on a report server has been disabled for Safari. Users must type the dates that they want to use.· Image source files that are retrieved from remote computers do not display correctly in Safari.· The client-side print control used for printing HTML reports.

If you are accessing a report server from a Macintosh computer, we recommend that you use Safari. Reporting Services does not support Internet Explorer 5.0 for the Mac.

For details, see
http://msdn2.microsoft.com/en-us/library/ms156511.aspx


Thanks.

|||

Hello,

Thanks.

But any how we want it to work on Sarafi and we did it by putting a transparent image with the width we want to display.

And it worked for us.

Thanks,
Deepesh Verma