Thanks
Guess I couldn't see the tree for the forest. Here is the solution in case anyone else has the issue. Get the NextRunDate property of the Job object in the Microsoft.SqlServer.Management.Smo.Agent namespace.
Thanks
Guess I couldn't see the tree for the forest. Here is the solution in case anyone else has the issue. Get the NextRunDate property of the Job object in the Microsoft.SqlServer.Management.Smo.Agent namespace.
I'm trying to do some housekeeping. I want to delete user tables from database(s) that have not had any activity...
I cannot seem to find a mechanism for accomplishing this. sysobjects only shows the createdate, not the last time a user table had a SELECT, INSERT, UPDATE or DELETE operation performed on it.
Anyone know how to do this ?
Thanks
(P.S. this is the second posting of this question today, as I went to my threads and I do not see the original post - sorry for the duplicate, but as I say, I do not see the original so am re-posting).
randyvol
SQL server doesn't store such information and all those process is logged in transction log, and you might need third party tools in this case to audit the events or run server side trace if you want to schedule such information for time being.|||Satya -
First and foremost thank you for your reply.
Next - what?!!? WOW! I just naturally assumed that SQL Server would do this. I cannot imagine a product that is being touted as 'ready for prime time' does not provide such basic necessities. Don't get me wrong, I really like the product, especially the 2k5 instantiation, which is why I'm even more perplexed.
How is one supposed to know over time what tables one can delete with absolute safety? I understand that 3rd party tools provide this ability, but surely they leverage something (perhaps undocumented) in the basic system? Teradata, for instance provides this information - I know, I'm a certified Teradata Master and have used that system's entries on many occasions to ascertain whether or not a table was really 'stale' and could be dropped to free up disk. I would not think it is that big a deal (or that much overhead) to have one extra column, say in sysobjects, for instance, 'last updated'.
I just cannot believe MSFT overlooked this, or expects me to cough up dollars for a 3rd party tool to do this routine maintenance chore. This is something I'd expect to find in the sys tables for sure. Doesn't have to be elegant and exposed into Studio - just basic data I can fetch with a query would suffice.
As for the tranlog.. it is transient. I'm sure that there is data there to mine, but it doesn't help me on the 100's of tables already existent on our legacy system, that have been around for years.
I sure hope MSFT decides to provide this ability soon.
(It does explain why I cannot find any documentation on how to do this though ;-)
Oh well, I guess I'll have to go build my own stuff and let it cook for a couple of quarters to see if tables are stale or not.
Regards
randyvol
I need to determine the actual date/time that a message was placed on the queue. In my "activated" procedure I want to log this information and pass it along to further processing routines. From what I can tell, the Queue table itself does not have this information captured.
Which time are you after. The time it was put on the initiator queue or the target queue?
You can add the time to the message when you send it.
|||Ideally, both.
I was looking for something out-of-the-box... not something where I craft my own message. The messages I will be receiving are based on a pre-defined schema and I did not want to go back to the design table with adding new elements. You would think that the "queue" table would have an additional column for "created date/time" basically.
If anything else, I think that should be a consideration for a future enhancement in the next version of Broker.
|||Please add a suggestion on connect.microsoft.com/sqlserver/feedback.
Make usre you say exactly which date you are after.
|||There would be a performance penalty for storing SENT and ENQUEUED times into the target queue for each message even if the user was not really interested in those statistics. Our current model is that any user-specific data (sent-timestamp, order-number, request-id, message-id, sender-user-name, etc) would be encapsulated into the message_body itself.Hello,
I am trying to create a SQL Statement which will identify if an entry can be added to a table or not. My table consists of 4 fields which are:
. UserID (Integer)
. StartTime (datetime)
. EndTime (datetime)
. Activity (varchar)
This is a timesheet application. I am trying to identify if a time entered by a user is valid or not. Basically, times cannot overlap. I'm trying to figure out how to code for the following conditions:
Assume an entry already exists for User 1 as follows:
. UserID: 1
. StartTime: 2006-12-30 08:00:00
. EndTime: 2006-12-30 08:15:00
. Activity: Test
I want to make sure that the following entries cannot be added by that user because they would overlap the existing entry:
. StartTime: 2006-12-30 07:50:00
. EndTime: 2006-12-30 08:05:00
OR
. StartTime: 2006-12-30 07:45:00
. EndTime: 2006-12-30 08:45:00
OR
. StartTime: 2006-12-30 08:05:00
. EndTime: 2006-12-30 08:30:00
OR
. StartTime: 2006-12-30 08:05:00
. EndTime: 2006-12-30 08:10:00
Any help is appreciated.
Thanks
Something like this...
select *
from timetrack_tbl
where
userid = 1
AND
(
(
'2006-12-30 07:50:00' between starttime and endtime
OR
'2006-12-30 08:05:00' between starttime and endtime
)
OR
(
'2006-12-30 07:50:00' <= starttime
AND
'2006-12-30 08:05:00' >= endtime
)
)
If you are going to be doing this continually, it might be a good choice for a function with the above code. Create the function to accept the userid, starting and ending dates and return some value indicating whether there is an overlap.
Example:
select dbo.CheckForOverlap(userid, '2006-12-30 07:50:00', '2006-12-30 08:05:00')
return something from the function that tells you if there is an overlap (like a bit, 1 = Overlap, 0 = No Overlap
|||
That worked like a charm.
Thank you so much for the quick response.
-- Val
I have several cubes deployed with several years worth of historical data. Every time that I add a measure item or make any minor change to the cube or project from BI Dev Studio and then deploy it to the server, it wipes out all of my cube data causing me to reprocess all of the cube partitions again. Is there a way to avoid having to do this or a better way to deploy metadata changes to the cubes?
Thanks!
Hello!
I do not understand the difference or any change in behaviour since OLAP Services(7). Since then, every time you make a major structural change to a cube, like adding a new measure, you have been forced to full process the cube and all related dimensions.
Nothing have changed in SSAS2005.
Regards
Thomas Ivarsson
|||Set the properties for your SSAS solution so that the Deployment Mode is "Deploy Changes Only" (This should be the default) and the Processing Option is "Default". If the changes are "minor", a full rebuild will not be required. Adding a new measure will require a complete rebuild of the measure group though.DELETE FROM MNT_R
WHERE MNT_R.TIMESTAMP < GETDATE()- 30
DELETE FROM MNT_R
WHERE MNT_R.TIMESTAMP < DATEADD(d, -30, GETDATE())
Here is the format of the values in column
MNT_R.TIMESTAMP
2005-08-09 06:06:44.577
2005-08-09 06:06:46.810
2005-08-09 06:06:49.060
So, since data are inserted into the MNT_R table every few seconds, my
delete statement will delete different number of rows, according to the
time of the day it runs.
Can you please post a SQL query that will not give me this headache?
thanx a lot allHi there,
You have to convert the source column to a non-using time format like
ISO:
DELETE FROM MNT_R
WHERE VARCHAR(10),MNT_R.TIMESTAMP < CONVERT(VARCHAR(10),GETDATE()-
30,112)
HTH, Jens Suessmeyer.|||nai (nioannides@.laiki.com) writes:
> When running the following SQL statements, I get the same results.
> Though I need to count only -30 days. Both statements below also
> consider the time of the day as well, which is not desired
>
> DELETE FROM MNT_R
> WHERE MNT_R.TIMESTAMP < GETDATE()- 30
> DELETE FROM MNT_R
> WHERE MNT_R.TIMESTAMP < DATEADD(d, -30, GETDATE())
>
> Here is the format of the values in column
> MNT_R.TIMESTAMP
> 2005-08-09 06:06:44.577
> 2005-08-09 06:06:46.810
> 2005-08-09 06:06:49.060
> So, since data are inserted into the MNT_R table every few seconds, my
> delete statement will delete different number of rows, according to the
> time of the day it runs.
> Can you please post a SQL query that will not give me this headache?
Instead of getdate() used convert(char(8), getdate(), 112) to strip
of the time portion.
--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx