|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 9:35 AM
Points: 6,713,
Visits: 11,746
|
|
ChrisM@Work (3/18/2013)
opc.three (3/15/2013) PS Forgot to mention the function is undocumented so take that into consideration.It's a cough scalar function too. Meh. We're talking about SQL Agent data so IMHO it's not something to get in a twist over (or even having a cough over)
__________________________________________________________________________________________________ There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Believe you can and you're halfway there. --Theodore Roosevelt
Everything Should Be Made as Simple as Possible, But Not Simpler --Albert Einstein
The significant problems we face cannot be solved at the same level of thinking we were at when we created them. --Albert Einstein
1 apple is not exactly 1/8 of 8 apples. Because there are no absolutely identical apples. --Giordy
|
|
|
|
|
SSC-Insane
         
Group: General Forum Members
Last Login: Today @ 8:07 AM
Points: 21,604,
Visits: 27,434
|
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 9:35 AM
Points: 6,713,
Visits: 11,746
|
|
Lynn Pettis (3/18/2013)
opc.three (3/18/2013)
ChrisM@Work (3/18/2013)
opc.three (3/15/2013) PS Forgot to mention the function is undocumented so take that into consideration.It's a cough scalar function too. Meh. We're talking about SQL Agent data so IMHO it's not something to get in a twist over (or even having a cough over)  Actually, the OP never did say if it was SQL Agent data that he was working with here. It could actually be data in his application database. Well, gee, I was thinking that was implied given the format of the data and was validated by the fact that the OP latched onto the msdb proc when replying directly to me, but you have a valid point. He could have been talking about data in an application database, or come to think of it, he could also have a shedload of historical data in his SQL Agent history tables but that would likely point to job-history maintenance issue.
@naveen.pasupuleti, could you tell us if you're applying this to SQL Agent data stored in msdb, or some other type of data source where you could be evaluating a non-trivial number of rows?
__________________________________________________________________________________________________ There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Believe you can and you're halfway there. --Theodore Roosevelt
Everything Should Be Made as Simple as Possible, But Not Simpler --Albert Einstein
The significant problems we face cannot be solved at the same level of thinking we were at when we created them. --Albert Einstein
1 apple is not exactly 1/8 of 8 apples. Because there are no absolutely identical apples. --Giordy
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Friday, May 17, 2013 12:43 PM
Points: 12,
Visits: 80
|
|
It is an application database used for reporting purposes, where I need to calculate datetime out of two integer columns (till last week, I calculated only date but new requirement asks for date and time). However, these int columns get data from msdb.dbo.sysjobservers as source table. This function msdb.dbo.agent_datetime(@int1, @int2) is helpful for me in both ways: 1. I applied for my immediate reporting purposes 2. I added a datetime column in my table, updated column for current data and used this function in SSIS package.
All solutions are good but built-in function is new learning & quick for me. I appreciate each of you for your responses.
Thanks, Naveen.
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 9:35 AM
Points: 6,713,
Visits: 11,746
|
|
OK, SQL Agent data, that's good, the use case fits, but you're repurposing it so how much data are we talking about? For managing SQL Agent historical data the scalar-function is fine because the volume is limited (if the instance is configured well) but if we're talking about a non-trivial amount of data you should consider switching to a home-made table-valued function instead. It will scale much better and not use anywhere near as much CPU.
__________________________________________________________________________________________________ There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Believe you can and you're halfway there. --Theodore Roosevelt
Everything Should Be Made as Simple as Possible, But Not Simpler --Albert Einstein
The significant problems we face cannot be solved at the same level of thinking we were at when we created them. --Albert Einstein
1 apple is not exactly 1/8 of 8 apples. Because there are no absolutely identical apples. --Giordy
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Friday, May 17, 2013 12:43 PM
Points: 12,
Visits: 80
|
|
Weekly once ~800 records. It should ok to use function at the moment. Yes, I would consider using TVF if data is significant.
|
|
|
|