Showing posts with label missing. Show all posts
Showing posts with label missing. Show all posts

Thursday, March 22, 2012

300 choose 10 - doing math with SQL Server, need some help...

Hey gang,
I have a question that may be more Math related than SQL Server related.
But maybe it's a simple thing & I'm missing it 'cause I'm trying too hard...
Here's the scenario: I have 300 products in a table. I also have last
year's sales figures, and this year's to-date sales figures. I want to
figure out which group of 10 products have the highest year-to-date sales AN
D
last year's sales combined to less than 10,000.
I have written a program that basically uses Where statements to iterate
through the 300 items, 10 times, calculating the best sales for this year
where last years sales are less than 10,000.
The problem is that there are 300 * 299 * 298 * 297 * 296 * 295 * 294 * 293
* 292 * 291 different combinations of products. That's a big freakin' numbe
r!
I've put in some minor checks to help speed things up slightly - things like
breaking where last years total is more than 10,000, etc. But she's still
gonna take about 42,000 years to get my result.
So what am I missing? What's the best way to accomplish what I'm trying to
do?
Any help would be appreciated...
Thanks,
GregGreg,
Could you post some minimal DDL for us to see? It could be a simple solution
...

> I've put in some minor checks to help speed things up slightly - things li
ke
> breaking where last years total is more than 10,000, etc. But she's still
> gonna take about 42,000 years to get my result.
As long as your billing for the processing time, I'm not sure I see the
problem with that ;-).
-- Alex|||OK - here's what I've got... I've taken out half the code to reduce the pos
t
- this assumes I'm only looking for the best THREE products. In fact, I'm
looking for ten...
I have a three user-defined functions that do basically the same thing -
look up a value in a table & return it.
CREATE FUNCTION LookupLastYear(@.ProdID int)
RETURNS money
AS
BEGIN
DECLARE @.out money
SET @.out = (SELECT LastYear FROM tblCurrentStats WHERE Prod=@.ProdID)
RETURN @.out
END
The code as it stands: (& if I screwed up with the flow by removing a huge
chunk of code, forgive me...) (As an aside, I'm sure this could have been
done using recursion, but I'm not sure how... Any tips would be
appreciated...)
Thanks in advance,
Greg
The Code:
CREATE PROCEDURE USP_Figure_Out_Best_Team AS
DECLARE @.Prod1 int
DECLARE @.Prod2 int
DECLARE @.Prod3 int
DECLARE @.LastYear1 money
DECLARE @.LastYear2 money
DECLARE @.LastYear3 money
DECLARE @.ThisYear1 money
DECLARE @.ThisYear2 money
DECLARE @.ThisYear3 money
DECLARE @.BestProd1 int
DECLARE @.BestProd2 int
DECLARE @.BestProd3 int
DECLARE @.BestTotal money
DECLARE @.Best2004 money
DECLARE @.TempTotal money
DECLARE @.TempLastYear money
SET @.BestTotal = 0
SET @.Best2004 = 0
SET @.TempTotal = 0
SET @.TempLastYear = 0
DECLARE @.Counter1 int
DECLARE @.Counter2 int
DECLARE @.Counter3 int
set @.Counter1 = 1
while @.Counter1 <=297
begin
SET @.ThisYear1 = dbo.lookupthisyear(@.counter1)
SET @.LastYear1 = dbo.lookuplastyear(@.counter1)
SET @.TempTotal = @.ThisYear1
SET @.TempLastYear = @.LastYear1
PRINT '1 ' + CONVERT(varchar, @.Counter1)
IF @.TempLastYear <=10000
BEGIN
SET @.Counter2 = @.Counter1 + 1
WHILE @.Counter2 <=297
BEGIN
SET @.ThisYear2 = dbo.lookupthisyear(@.counter2)
SET @.LastYear2 = dbo.lookuplastyear(@.counter2)
SET @.TempTotal = @.TempTotal + @.ThisYear2
SET @.TempLastYear = @.TempLastYear + @.LastYear2
PRINT '2: ' + CONVERT(varchar, @.Counter2)
IF @.TempLastYear <=10000
BEGIN
SET @.Counter3 = @.Counter2 + 1
WHILE @.Counter3 <=297
BEGIN
SET @.ThisYear3 = dbo.lookupthisyear(@.counter3)
SET @.LastYear3 = dbo.lookuplastyear(@.counter3)
SET @.TempTotal = @.TempTotal + @.ThisYear3
SET @.TempLastYear = @.TempLastYear + @.LastYear3
PRINT '3: ' + CONVERT(varchar, @.Counter3)
IF @.TempLastYear <=10000
BEGIN
if @.temptotal > @.BestTotal AND @.TempLastYear <=10000
BEGIN
PRINT ''
PRINT 'New Best'
PRINT dbo.lookupProd(@.Counter1)
PRINT dbo.lookupProd(@.Counter2)
PRINT dbo.lookupProd(@.Counter3)
PRINT '2004 Total:' + CONVERT(varchar,@.TempLastYear)
PRINT '2005 Total:' + CONVERT(varchar,@.TempTotal)
SET @.BestProd1 = @.Counter1
SET @.BestProd2 = @.Counter2
SET @.BestProd3 = @.Counter3
SET @.BestTotal = @.TempTotal
SET @.Best2004 = @.TempLastYear
INSERT INTO tblOptimal
VALUES
(GETDATE(),
dbo.lookupProd(@.Counter1),
dbo.lookupProd(@.Counter2),
dbo.lookupProd(@.Counter3),
@.Best2004,
@.BestTotal)
END
SET @.Counter3 = @.Counter3 + 1
SET @.TempTotal = @.TempTotal - @.ThisYear3
SET @.TempLastYear = @.TempLastYear - @.LastYear3
END
END
SET @.Counter2 = @.Counter2 + 1
SET @.TempTotal = @.TempTotal - @.ThisYear2
SET @.TempLastYear = @.TempLastYear - @.LastYear2
end
END
SET @.Counter1 = @.Counter1 + 1
end
PRINT 'Optimal:'
PRINT dbo.lookupProd(@.BestProd1)
PRINT dbo.lookupProd(@.BestProd2)
PRINT dbo.lookupProd(@.BestProd3)
PRINT '2004: ' + CONVERT(varchar, @.Best2004)
PRINT '2005: ' + CONVERT(varchar,@.BestTotal)
GO
"Alex Papadimoulis" wrote:

> Greg,
> Could you post some minimal DDL for us to see? It could be a simple soluti
on
> ...
>
> As long as your billing for the processing time, I'm not sure I see the
> problem with that ;-).
> -- Alex|||I'm still having a hard time understanding your schema ... post DDL for the
tables.
BUT, from what I can tell so far, it looks selecting a single value at a
time, comparing, and moving to the next row -- three levels deep.
Have you tried doing a JOIN? It would seem like a join would solve this and
let the DB optimize ...
-- Alex
"Alex Papadimoulis" wrote:

> Greg,
> Could you post some minimal DDL for us to see? It could be a simple soluti
on
> ...
>
> As long as your billing for the processing time, I'm not sure I see the
> problem with that ;-).
> -- Alex|||If I understand you correctly, why not just
Select Top 10 ProductID
From (Select ProductID, Sum(SalesAmt) TotalSales
From SalesTable
Where SalesDate >= '20040101'
Group By ProductID)
Where TotalSales < 10000
Order By TotalSales Desc
"Greg Toronto" wrote:

> Hey gang,
> I have a question that may be more Math related than SQL Server related.
> But maybe it's a simple thing & I'm missing it 'cause I'm trying too hard.
.
> Here's the scenario: I have 300 products in a table. I also have last
> year's sales figures, and this year's to-date sales figures. I want to
> figure out which group of 10 products have the highest year-to-date sales
AND
> last year's sales combined to less than 10,000.
> I have written a program that basically uses Where statements to iterate
> through the 300 items, 10 times, calculating the best sales for this year
> where last years sales are less than 10,000.
> The problem is that there are 300 * 299 * 298 * 297 * 296 * 295 * 294 * 29
3
> * 292 * 291 different combinations of products. That's a big freakin' num
ber!
> I've put in some minor checks to help speed things up slightly - things li
ke
> breaking where last years total is more than 10,000, etc. But she's still
> gonna take about 42,000 years to get my result.
> So what am I missing? What's the best way to accomplish what I'm trying t
o
> do?
> Any help would be appreciated...
> Thanks,
> Greg|||Greg,
Please post DDL, sample data and expected results, as documented in
http://www.aspfaq.com/etiquette.asp?id=5006
I will assume some simple DDL and sample data:
CREATE TABLE SalesTotals (
ProductID int,
TheYear smallint,
Total money NOT NULL,
PRIMARY KEY (TheYear, ProductID)
)
INSERT INTO SalesTotals VALUES (1, 2004, 1000)
INSERT INTO SalesTotals VALUES (2, 2004, 2000)
INSERT INTO SalesTotals VALUES (3, 2004, 3000)
INSERT INTO SalesTotals VALUES (4, 2004, 4000)
INSERT INTO SalesTotals VALUES (5, 2004, 5000)
INSERT INTO SalesTotals VALUES (6, 2004, 500)
INSERT INTO SalesTotals VALUES (7, 2004, 3500)
INSERT INTO SalesTotals VALUES (8, 2004, 4000)
INSERT INTO SalesTotals VALUES (9, 2004, 5500)
INSERT INTO SalesTotals VALUES (10,2004, 5000)
INSERT INTO SalesTotals VALUES (1, 2005,11000)
INSERT INTO SalesTotals VALUES (2, 2005, 7500)
INSERT INTO SalesTotals VALUES (3, 2005, 5000)
INSERT INTO SalesTotals VALUES (4, 2005,16000)
INSERT INTO SalesTotals VALUES (5, 2005,17000)
INSERT INTO SalesTotals VALUES (6, 2005, 2500)
INSERT INTO SalesTotals VALUES (7, 2005,23500)
INSERT INTO SalesTotals VALUES (8, 2005,25500)
INSERT INTO SalesTotals VALUES (9, 2005,11500)
INSERT INTO SalesTotals VALUES (10,2005,27500)
One solution is:
SELECT TOP 1 A1.ProductID, A2.ProductID, A3.ProductID,
A1.Total+A2.Total+A3.Total as Total2005,
B1.Total+B2.Total+B3.Total as Total2004
FROM SalesTotals A1, SalesTotals A2, SalesTotals A3,
SalesTotals B1, SalesTotals B2, SalesTotals B3
WHERE A1.ProductID=B1.ProductID AND A2.ProductID=B2.ProductID AND
A3.ProductID=B3.ProductID
AND A1.ProductID<A2.ProductID AND A2.ProductID<A3.ProductID
AND A1.TheYear=2005 AND A2.TheYear=2005 AND A3.TheYear=2005
AND B1.TheYear=2004 AND B2.TheYear=2004 AND B3.TheYear=2004
AND B1.Total+B2.Total+B3.Total<10000
ORDER BY Total2005 DESC
For 3 products out of 10, this works instantaneous, but I would not
dare to think how much time and memory it would require for 10 products
out of 300.
The way you put it, this is the kind of problem that cannot be computed
in a reasonable time (this class of problems is called "NP-complete",
and this problem is called "knapsack problem").
The best thing you could do, is change the requirements, for example:
a) say "last year's sales for each product are less than 2,000" instead
of "the combined last year's sales are less than 10,000"
b) say "among the highest" instead of "highest"
For the second option, one algorithm that works in a reasonable time
is:
DECLARE @.Temp1 TABLE (
RowNum int NOT NULL IDENTITY UNIQUE,
ProductID int PRIMARY KEY,
Value2004 money NOT NULL,
Value2005 money NOT NULL
)
DECLARE @.Temp2 TABLE (
ProductID int PRIMARY KEY
)
INSERT INTO @.Temp1 (ProductID, Value2004, Value2005)
SELECT A.ProductID, B.Total, A.Total
FROM SalesTotals A INNER JOIN SalesTotals B
ON A.ProductID=B.ProductID AND A.TheYear=2005 AND B.TheYear=2004
ORDER BY A.Total-B.Total DESC, B.Total ASC
DECLARE @.P int, @.N tinyint, @.S money
SET @.N=0
SET @.S=0
WHILE @.N<3 BEGIN
SELECT TOP 1 @.P=ProductID, @.N=@.N+1, @.S=@.S+Value2004
FROM @.Temp1 WHERE @.S+Value2004<10000
AND ProductID NOT IN (SELECT ProductID FROM @.Temp2)
ORDER BY RowNum
INSERT INTO @.Temp2 VALUES (@.P)
END
SELECT ProductID, Value2004, Value2005 FROM @.Temp1
WHERE ProductID IN (SELECT ProductID FROM @.Temp2)
For this sample data, this algorithm returns the set {6, 8, 10}, which
has a total of 55,500, but the best set would have been {1, 7, 10} with
a total of 62,000. However, for other input data, this algorithm may
happen to guess the best set.
Razvan
PS. Again, I have written non-portable code, using Microsoft-specific
extensions... I apologize for doing this and I invite other posters to
write these queries in ANSI-SQL. At this time, I could not find a
ANSI-SQL solution that has the same or better performance in SQL Server
2000 as this non-portable solution. I'm not saying that it doesn't
exist, I just wasn't able to find it now.|||Greg,
To add to what Razvan said, this also sounds to me like a variation of
a knapsack problem, and while such problems have no known efficient
algorithms, a technique that can be useful is called "dynamic programming".
One optimistic detail is that you want the highest year-to-date sales. If
the secondary condition were not in place, this would be easy (find the 10
products with the highest year-to-date sales). You might get lucky if you
do something like this, which tries finding the answer within groups of 12
products with high YTD sales but low last-year sales, adjusting what
"low" means until something is found.
declare @.criterion int
set @.criterion = 5000 -- something <= 10000 to start
while 1=1 begin
select top 1 subset of size 10 from (
select top 12 ProductID
where last-year-sales < @.criterion
order by YTD-sales desc
) as Lucky
having sum(last-year-sales) < 10000
order by sum(YTD-sales) desc
if @.@.rowcount = 0 set @.criterion = @.criterion*0.95
else return what you found
if @.criterion < 1 break
end
Steve Kass
Drew University
Greg Toronto wrote:

>Hey gang,
>I have a question that may be more Math related than SQL Server related.
>But maybe it's a simple thing & I'm missing it 'cause I'm trying too hard..
.
>Here's the scenario: I have 300 products in a table. I also have last
>year's sales figures, and this year's to-date sales figures. I want to
>figure out which group of 10 products have the highest year-to-date sales A
ND
>last year's sales combined to less than 10,000.
>I have written a program that basically uses Where statements to iterate
>through the 300 items, 10 times, calculating the best sales for this year
>where last years sales are less than 10,000.
>The problem is that there are 300 * 299 * 298 * 297 * 296 * 295 * 294 * 293
>* 292 * 291 different combinations of products. That's a big freakin' numb
er!
>I've put in some minor checks to help speed things up slightly - things lik
e
>breaking where last years total is more than 10,000, etc. But she's still
>gonna take about 42,000 years to get my result.
>So what am I missing? What's the best way to accomplish what I'm trying to
>do?
>Any help would be appreciated...
>Thanks,
>Greg
>|||If you want the Products with the Highest CurrentYear Sales, which had
PriorYearSales < 10000, then this should work:
Select Top 10 ProductID
From (Select ProductID,
Sum(Case When SalesDate >= '20040101'
And SalesDate < '20050101'
ThenSalesAmt End) As PriorYearSales,
Sum(Case When SalesDate >= '20050101'
ThenSalesAmt End) As CurrYearSales
From SalesTable
Where SalesDate >= '20040101'
Group By ProductID) As Sales
Where PriorYearSales < 10000
Order By CurrYearSales Desc
"Greg Toronto" wrote:

> Hey gang,
> I have a question that may be more Math related than SQL Server related.
> But maybe it's a simple thing & I'm missing it 'cause I'm trying too hard.
.
> Here's the scenario: I have 300 products in a table. I also have last
> year's sales figures, and this year's to-date sales figures. I want to
> figure out which group of 10 products have the highest year-to-date sales
AND
> last year's sales combined to less than 10,000.
> I have written a program that basically uses Where statements to iterate
> through the 300 items, 10 times, calculating the best sales for this year
> where last years sales are less than 10,000.
> The problem is that there are 300 * 299 * 298 * 297 * 296 * 295 * 294 * 29
3
> * 292 * 291 different combinations of products. That's a big freakin' num
ber!
> I've put in some minor checks to help speed things up slightly - things li
ke
> breaking where last years total is more than 10,000, etc. But she's still
> gonna take about 42,000 years to get my result.
> So what am I missing? What's the best way to accomplish what I'm trying t
o
> do?
> Any help would be appreciated...
> Thanks,
> Greg|||>> I have 300 products in a table. I also have last year's sales
figures, and this year's to-date sales figures. I want to figure out
which group of 10 products have the highest year-to-date sales and last
year's sales combined to less than 10,000. <<
I am little on this one. One way to read this is that each of
the products in the basket of ten items had less than $10,000 in sales
last year; the other way is that the entire basket had less than
$10,000 in sales last year.
First way is fairly easy:
SELECT X.product_id, X.this_yr_amt
FROM (SELECT product_id
SUM (CASE WHEN sales_date
BETWEEN '2004-01-01'AND '2004-12-31'
THEN sales_amt ELSE 0.00 END),
SUM (CASE WHEN sales_date > '2004-12-31'
THEN sales_amt ELSE 0.00 END)
FROM Sales
GROUP BY product_id)
AS X(product_id, last_yr_amt, this_yr_amt)
WHERE X.last_yr_amt < 10000.00;
The second way is a screaming pain because it is a "Bin Packing
Problem", which are known to be NP-complete. Google it. Then we can
have ties for two baskets to consider. Then we can have to handle
baskets with less than ten items. What if no such baskets exist in the
data? It gets ugly fast, and I do mean NP fast.
In SQL because it is a set-oriented language, you tend to get the set
of ALL answers, which mean you have to try ALL combinations. In the
real world, getting the first workable answer and quitting is often
good enough.
I would put my X() derived table into a VIEW, use a Cursor and a back
tracking algorithm in a procedural language.
1) Grab the top ten sellers for this year; if two products are tied,
then use the one with the lowest sale for last year. Make a Greedy
start.
2) Check the basket total for last year and stop if it is < $10000.
3) If not, replace one of the basket items with the item on the list
which has the highest this_year_amt and a last_year_amt lower than the
item it is replacing.
4) Repeat until all 300 items have been inspected or until you get a
halt condition.
This is probably not optimal and it depends on step #3, rule for
replacement.|||Steve, why not just create an aggregate SubQuery, that calculates the
PriorYears Sales amnd the current Years sales, grouped on Product ID,
Select ProductID,
Sum(Case When SalesDate >= '20040101'
And SalesDate < '20050101'
ThenSalesAmt End) As PriorYearSales,
Sum(Case When SalesDate >= '20050101'
ThenSalesAmt End) As CurrYearSales
From SalesTable
Where SalesDate >= '20040101' -- Not even necessary
Group By ProductID
And Then Select from this subquery the top 10 Records after filtering on
PriorYearSales < 10000, and ordering By CurrYearSales
-- *******************
Select Top 10 ProductID
From (Select ProductID,
Sum(Case When SalesDate >= '20040101'
And SalesDate < '20050101'
ThenSalesAmt End) As PriorYearSales,
Sum(Case When SalesDate >= '20050101'
ThenSalesAmt End) As CurrYearSales
From SalesTable
Where SalesDate >= '20040101'
Group By ProductID) As Sales
Where PriorYearSales < 10000
Order By CurrYearSales Desc
"Steve Kass" wrote:

> Greg,
> To add to what Razvan said, this also sounds to me like a variation of
> a knapsack problem, and while such problems have no known efficient
> algorithms, a technique that can be useful is called "dynamic programming"
.
> One optimistic detail is that you want the highest year-to-date sales.
If
> the secondary condition were not in place, this would be easy (find the 10
> products with the highest year-to-date sales). You might get lucky if you
> do something like this, which tries finding the answer within groups of 12
> products with high YTD sales but low last-year sales, adjusting what
> "low" means until something is found.
> declare @.criterion int
> set @.criterion = 5000 -- something <= 10000 to start
> while 1=1 begin
> select top 1 subset of size 10 from (
> select top 12 ProductID
> where last-year-sales < @.criterion
> order by YTD-sales desc
> ) as Lucky
> having sum(last-year-sales) < 10000
> order by sum(YTD-sales) desc
> if @.@.rowcount = 0 set @.criterion = @.criterion*0.95
> else return what you found
> if @.criterion < 1 break
> end
> Steve Kass
> Drew University
>
> Greg Toronto wrote:
>
>

Monday, March 19, 2012

2nd Try: Restore Database Dialog missing Backups (Archive BIT)

I have a strange problem with restoring files. I have one SQL server
installation that does not show any .BAK files that no longer have the
archive bit set. Is there a switch somewhere that I can throw to
change this back?
I have 3 other SQL server installations in different places that do
not have this issue.
Thanks,
Doug
"Doug Crabtree" <not@.gonna.tell> wrote in message
news:GPKdnbA9tLgxur_cRVn-rw@.comcast.com...
> I have a strange problem with restoring files. I have one SQL server
> installation that does not show any .BAK files that no longer have the
> archive bit set. Is there a switch somewhere that I can throw to
> change this back?
> I have 3 other SQL server installations in different places that do
> not have this issue.
You can change the archive bit from a command prompt with the ATTRIB
command. It sounds like you may have backup software running that is
resetting the bit. This should not prevent you from restoring any backup
files, perhaps there is something else going on here?
Steve
|||I can reset the bit, our backup is indeed changing it.
But the problem remains that the dialog that shows the backups does not show
those without the bit. Only 1 server does it. All our other servers show
it regardless of the archive bit. I was just hoping somebody out there knew
why this was happening.
Thanks,
Doug
"Steve Thompson" <stevethompson@.nomail.please> wrote in message
news:%23qtYktIhEHA.2908@.TK2MSFTNGP10.phx.gbl...
> You can change the archive bit from a command prompt with the ATTRIB
> command. It sounds like you may have backup software running that is
> resetting the bit. This should not prevent you from restoring any backup
> files, perhaps there is something else going on here?
> Steve
>
|||AFAIK, the restore dialog doesn't care at all whether the backup files archive bit is set or not.
Actually, it doesn't even care whether the file in question *exists*. My guess is that your problem
is elsewhere. You might want to troubleshoot this by doing a backup, verify that EM show this, set
the archive bit and check EM again.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Doug Crabtree" <not@.gonna.tell> wrote in message news:tcydnc2FZ7rZ_r_cRVn-vQ@.comcast.com...
> I can reset the bit, our backup is indeed changing it.
> But the problem remains that the dialog that shows the backups does not show
> those without the bit. Only 1 server does it. All our other servers show
> it regardless of the archive bit. I was just hoping somebody out there knew
> why this was happening.
> Thanks,
> Doug
> "Steve Thompson" <stevethompson@.nomail.please> wrote in message
> news:%23qtYktIhEHA.2908@.TK2MSFTNGP10.phx.gbl...
>
|||I have tried that. It dissapears from the selection dialog when the archive
bit is not set. When set, it appears again.
Strange...
Thanks anyway,
Doug
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:ePeJe3OhEHA.3272@.TK2MSFTNGP11.phx.gbl...
> AFAIK, the restore dialog doesn't care at all whether the backup files
archive bit is set or not.
> Actually, it doesn't even care whether the file in question *exists*. My
guess is that your problem
> is elsewhere. You might want to troubleshoot this by doing a backup,
verify that EM show this, set
> the archive bit and check EM again.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
|||Strange indeed. Can you point me to exactly what dialog you refer to (how to you "click" to get
there) and I'll give it a spin. I've never encountered this, or even thought about the archive bit
being relevant...
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Doug Crabtree" <not@.gonna.tell> wrote in message news:nOOdnVUDjKWVzr7cRVn-qA@.comcast.com...
> I have tried that. It dissapears from the selection dialog when the archive
> bit is not set. When set, it appears again.
> Strange...
> Thanks anyway,
> Doug
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
> message news:ePeJe3OhEHA.3272@.TK2MSFTNGP11.phx.gbl...
> archive bit is set or not.
> guess is that your problem
> verify that EM show this, set
>
|||In Enterprise Manager, Right click on Databases, and select All Tasks ->
Restore Database...
"Restore Database" Dialog Box
Restore as database: <<DBNAME>>
From Device selected
Restore backup set (Database - complete) selected
Click Select Devices button
"Choose Restore Devices" Dialog Box
Disk selected
Click Add button
"Choose Restore Destination" dialog box:
File Name (click the ...)
"Backup Device Location - <<SERVERNAME>>" Dialog box:
They don't show.
Interesting, though ... I copied one of the backups to another disk, turned
off the archive bit, and it showed there. Something about that drive?
Permissions? We have the Server running as an administrator's account.
Would that have anything to do with it?
Thanks,
Doug
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:OtgmcOShEHA.1156@.TK2MSFTNGP10.phx.gbl...
> Strange indeed. Can you point me to exactly what dialog you refer to (how
to you "click" to get
> there) and I'll give it a spin. I've never encountered this, or even
thought about the archive bit
> being relevant...
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
|||I tried your steps and I could not reproduce, the file did show, regardless of what I set the "the file is
ready for ..." option in Explorer (I assume this is the ol' archive bit).
I did a Profiler trace and it seems like EM is executing xp_dirtree to get this list. This might give you
something to go on when searching KB, Google etc.
Also, opening a case with MS might be an option.
I doubt is has anything to do with permissions. But who know...
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Doug Crabtree" <not@.gonna.tell> wrote in message news:np-dnVZYZaxf9b7cRVn-ig@.comcast.com...
> In Enterprise Manager, Right click on Databases, and select All Tasks ->
> Restore Database...
> "Restore Database" Dialog Box
> Restore as database: <<DBNAME>>
> From Device selected
> Restore backup set (Database - complete) selected
> Click Select Devices button
> "Choose Restore Devices" Dialog Box
> Disk selected
> Click Add button
> "Choose Restore Destination" dialog box:
> File Name (click the ...)
> "Backup Device Location - <<SERVERNAME>>" Dialog box:
> They don't show.
> ----
> --
> Interesting, though ... I copied one of the backups to another disk, turned
> off the archive bit, and it showed there. Something about that drive?
> Permissions? We have the Server running as an administrator's account.
> Would that have anything to do with it?
> Thanks,
> Doug
>
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
> message news:OtgmcOShEHA.1156@.TK2MSFTNGP10.phx.gbl...
> to you "click" to get
> thought about the archive bit
>
|||Interesting problem indeed -- can you use the "native" T-SQL RESTORE to
perform the database restore?
Steve
"Doug Crabtree" <not@.gonna.tell> wrote in message
news:np-dnVZYZaxf9b7cRVn-ig@.comcast.com...
> In Enterprise Manager, Right click on Databases, and select All Tasks ->
> Restore Database...
> "Restore Database" Dialog Box
> Restore as database: <<DBNAME>>
> From Device selected
> Restore backup set (Database - complete) selected
> Click Select Devices button
> "Choose Restore Devices" Dialog Box
> Disk selected
> Click Add button
> "Choose Restore Destination" dialog box:
> File Name (click the ...)
> "Backup Device Location - <<SERVERNAME>>" Dialog box:
> They don't show.
> ----
--
> --
> Interesting, though ... I copied one of the backups to another disk,
turned
> off the archive bit, and it showed there. Something about that drive?
> Permissions? We have the Server running as an administrator's account.
> Would that have anything to do with it?
> Thanks,
> Doug
>
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote
in[vbcol=seagreen]
> message news:OtgmcOShEHA.1156@.TK2MSFTNGP10.phx.gbl...
(how
> to you "click" to get
> thought about the archive bit
>
|||I can acutally just type in the name of the file in the "Choose Restore
Destination" Dialog Box. It will restore it, they just don't show in the
dir tree.
Doug
"Steve Thompson" <stevethompson@.nomail.please> wrote in message
news:uxhb6pUhEHA.3664@.TK2MSFTNGP12.phx.gbl...
> Interesting problem indeed -- can you use the "native" T-SQL RESTORE to
> perform the database restore?
> Steve

2nd Try: Restore Database Dialog missing Backups (Archive BIT)

I have a strange problem with restoring files. I have one SQL server
installation that does not show any .BAK files that no longer have the
archive bit set. Is there a switch somewhere that I can throw to
change this back?
I have 3 other SQL server installations in different places that do
not have this issue.
Thanks,
Doug"Doug Crabtree" <not@.gonna.tell> wrote in message
news:GPKdnbA9tLgxur_cRVn-rw@.comcast.com...
> I have a strange problem with restoring files. I have one SQL server
> installation that does not show any .BAK files that no longer have the
> archive bit set. Is there a switch somewhere that I can throw to
> change this back?
> I have 3 other SQL server installations in different places that do
> not have this issue.
You can change the archive bit from a command prompt with the ATTRIB
command. It sounds like you may have backup software running that is
resetting the bit. This should not prevent you from restoring any backup
files, perhaps there is something else going on here?
Steve|||I can reset the bit, our backup is indeed changing it.
But the problem remains that the dialog that shows the backups does not show
those without the bit. Only 1 server does it. All our other servers show
it regardless of the archive bit. I was just hoping somebody out there knew
why this was happening.
Thanks,
Doug
"Steve Thompson" <stevethompson@.nomail.please> wrote in message
news:%23qtYktIhEHA.2908@.TK2MSFTNGP10.phx.gbl...
> You can change the archive bit from a command prompt with the ATTRIB
> command. It sounds like you may have backup software running that is
> resetting the bit. This should not prevent you from restoring any backup
> files, perhaps there is something else going on here?
> Steve
>|||AFAIK, the restore dialog doesn't care at all whether the backup files archive bit is set or not.
Actually, it doesn't even care whether the file in question *exists*. My guess is that your problem
is elsewhere. You might want to troubleshoot this by doing a backup, verify that EM show this, set
the archive bit and check EM again.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Doug Crabtree" <not@.gonna.tell> wrote in message news:tcydnc2FZ7rZ_r_cRVn-vQ@.comcast.com...
> I can reset the bit, our backup is indeed changing it.
> But the problem remains that the dialog that shows the backups does not show
> those without the bit. Only 1 server does it. All our other servers show
> it regardless of the archive bit. I was just hoping somebody out there knew
> why this was happening.
> Thanks,
> Doug
> "Steve Thompson" <stevethompson@.nomail.please> wrote in message
> news:%23qtYktIhEHA.2908@.TK2MSFTNGP10.phx.gbl...
> > You can change the archive bit from a command prompt with the ATTRIB
> > command. It sounds like you may have backup software running that is
> > resetting the bit. This should not prevent you from restoring any backup
> > files, perhaps there is something else going on here?
> >
> > Steve
> >
> >
>|||I have tried that. It dissapears from the selection dialog when the archive
bit is not set. When set, it appears again.
Strange...
Thanks anyway,
Doug
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:ePeJe3OhEHA.3272@.TK2MSFTNGP11.phx.gbl...
> AFAIK, the restore dialog doesn't care at all whether the backup files
archive bit is set or not.
> Actually, it doesn't even care whether the file in question *exists*. My
guess is that your problem
> is elsewhere. You might want to troubleshoot this by doing a backup,
verify that EM show this, set
> the archive bit and check EM again.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/|||Strange indeed. Can you point me to exactly what dialog you refer to (how to you "click" to get
there) and I'll give it a spin. I've never encountered this, or even thought about the archive bit
being relevant...
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Doug Crabtree" <not@.gonna.tell> wrote in message news:nOOdnVUDjKWVzr7cRVn-qA@.comcast.com...
> I have tried that. It dissapears from the selection dialog when the archive
> bit is not set. When set, it appears again.
> Strange...
> Thanks anyway,
> Doug
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
> message news:ePeJe3OhEHA.3272@.TK2MSFTNGP11.phx.gbl...
> > AFAIK, the restore dialog doesn't care at all whether the backup files
> archive bit is set or not.
> > Actually, it doesn't even care whether the file in question *exists*. My
> guess is that your problem
> > is elsewhere. You might want to troubleshoot this by doing a backup,
> verify that EM show this, set
> > the archive bit and check EM again.
> >
> > --
> > Tibor Karaszi, SQL Server MVP
> > http://www.karaszi.com/sqlserver/default.asp
> > http://www.solidqualitylearning.com/
>|||In Enterprise Manager, Right click on Databases, and select All Tasks ->
Restore Database...
"Restore Database" Dialog Box
Restore as database: <<DBNAME>>
From Device selected
Restore backup set (Database - complete) selected
Click Select Devices button
"Choose Restore Devices" Dialog Box
Disk selected
Click Add button
"Choose Restore Destination" dialog box:
File Name (click the ...)
"Backup Device Location - <<SERVERNAME>>" Dialog box:
They don't show.
----
--
Interesting, though ... I copied one of the backups to another disk, turned
off the archive bit, and it showed there. Something about that drive?
Permissions? We have the Server running as an administrator's account.
Would that have anything to do with it?
Thanks,
Doug
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:OtgmcOShEHA.1156@.TK2MSFTNGP10.phx.gbl...
> Strange indeed. Can you point me to exactly what dialog you refer to (how
to you "click" to get
> there) and I'll give it a spin. I've never encountered this, or even
thought about the archive bit
> being relevant...
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/|||I tried your steps and I could not reproduce, the file did show, regardless of what I set the "the file is
ready for ..." option in Explorer (I assume this is the ol' archive bit).
I did a Profiler trace and it seems like EM is executing xp_dirtree to get this list. This might give you
something to go on when searching KB, Google etc.
Also, opening a case with MS might be an option.
I doubt is has anything to do with permissions. But who know...
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Doug Crabtree" <not@.gonna.tell> wrote in message news:np-dnVZYZaxf9b7cRVn-ig@.comcast.com...
> In Enterprise Manager, Right click on Databases, and select All Tasks ->
> Restore Database...
> "Restore Database" Dialog Box
> Restore as database: <<DBNAME>>
> From Device selected
> Restore backup set (Database - complete) selected
> Click Select Devices button
> "Choose Restore Devices" Dialog Box
> Disk selected
> Click Add button
> "Choose Restore Destination" dialog box:
> File Name (click the ...)
> "Backup Device Location - <<SERVERNAME>>" Dialog box:
> They don't show.
> ----
> --
> Interesting, though ... I copied one of the backups to another disk, turned
> off the archive bit, and it showed there. Something about that drive?
> Permissions? We have the Server running as an administrator's account.
> Would that have anything to do with it?
> Thanks,
> Doug
>
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
> message news:OtgmcOShEHA.1156@.TK2MSFTNGP10.phx.gbl...
> > Strange indeed. Can you point me to exactly what dialog you refer to (how
> to you "click" to get
> > there) and I'll give it a spin. I've never encountered this, or even
> thought about the archive bit
> > being relevant...
> >
> > --
> > Tibor Karaszi, SQL Server MVP
> > http://www.karaszi.com/sqlserver/default.asp
> > http://www.solidqualitylearning.com/
>|||Interesting problem indeed -- can you use the "native" T-SQL RESTORE to
perform the database restore?
Steve
"Doug Crabtree" <not@.gonna.tell> wrote in message
news:np-dnVZYZaxf9b7cRVn-ig@.comcast.com...
> In Enterprise Manager, Right click on Databases, and select All Tasks ->
> Restore Database...
> "Restore Database" Dialog Box
> Restore as database: <<DBNAME>>
> From Device selected
> Restore backup set (Database - complete) selected
> Click Select Devices button
> "Choose Restore Devices" Dialog Box
> Disk selected
> Click Add button
> "Choose Restore Destination" dialog box:
> File Name (click the ...)
> "Backup Device Location - <<SERVERNAME>>" Dialog box:
> They don't show.
> ----
--
> --
> Interesting, though ... I copied one of the backups to another disk,
turned
> off the archive bit, and it showed there. Something about that drive?
> Permissions? We have the Server running as an administrator's account.
> Would that have anything to do with it?
> Thanks,
> Doug
>
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote
in
> message news:OtgmcOShEHA.1156@.TK2MSFTNGP10.phx.gbl...
> > Strange indeed. Can you point me to exactly what dialog you refer to
(how
> to you "click" to get
> > there) and I'll give it a spin. I've never encountered this, or even
> thought about the archive bit
> > being relevant...
> >
> > --
> > Tibor Karaszi, SQL Server MVP
> > http://www.karaszi.com/sqlserver/default.asp
> > http://www.solidqualitylearning.com/
>|||I can acutally just type in the name of the file in the "Choose Restore
Destination" Dialog Box. It will restore it, they just don't show in the
dir tree.
Doug
"Steve Thompson" <stevethompson@.nomail.please> wrote in message
news:uxhb6pUhEHA.3664@.TK2MSFTNGP12.phx.gbl...
> Interesting problem indeed -- can you use the "native" T-SQL RESTORE to
> perform the database restore?
> Steve

2nd Try: Restore Database Dialog missing Backups (Archive BIT)

I have a strange problem with restoring files. I have one SQL server
installation that does not show any .BAK files that no longer have the
archive bit set. Is there a switch somewhere that I can throw to
change this back?
I have 3 other SQL server installations in different places that do
not have this issue.
Thanks,
Doug"Doug Crabtree" <not@.gonna.tell> wrote in message
news:GPKdnbA9tLgxur_cRVn-rw@.comcast.com...
> I have a strange problem with restoring files. I have one SQL server
> installation that does not show any .BAK files that no longer have the
> archive bit set. Is there a switch somewhere that I can throw to
> change this back?
> I have 3 other SQL server installations in different places that do
> not have this issue.
You can change the archive bit from a command prompt with the ATTRIB
command. It sounds like you may have backup software running that is
resetting the bit. This should not prevent you from restoring any backup
files, perhaps there is something else going on here?
Steve|||I can reset the bit, our backup is indeed changing it.
But the problem remains that the dialog that shows the backups does not show
those without the bit. Only 1 server does it. All our other servers show
it regardless of the archive bit. I was just hoping somebody out there knew
why this was happening.
Thanks,
Doug
"Steve Thompson" <stevethompson@.nomail.please> wrote in message
news:%23qtYktIhEHA.2908@.TK2MSFTNGP10.phx.gbl...
> You can change the archive bit from a command prompt with the ATTRIB
> command. It sounds like you may have backup software running that is
> resetting the bit. This should not prevent you from restoring any backup
> files, perhaps there is something else going on here?
> Steve
>|||AFAIK, the restore dialog doesn't care at all whether the backup files archi
ve bit is set or not.
Actually, it doesn't even care whether the file in question *exists*. My gue
ss is that your problem
is elsewhere. You might want to troubleshoot this by doing a backup, verify
that EM show this, set
the archive bit and check EM again.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Doug Crabtree" <not@.gonna.tell> wrote in message news:tcydnc2FZ7rZ_r_cRVn-vQ@.comcast.com...

> I can reset the bit, our backup is indeed changing it.
> But the problem remains that the dialog that shows the backups does not sh
ow
> those without the bit. Only 1 server does it. All our other servers show
> it regardless of the archive bit. I was just hoping somebody out there kn
ew
> why this was happening.
> Thanks,
> Doug
> "Steve Thompson" <stevethompson@.nomail.please> wrote in message
> news:%23qtYktIhEHA.2908@.TK2MSFTNGP10.phx.gbl...
>|||I have tried that. It dissapears from the selection dialog when the archive
bit is not set. When set, it appears again.
Strange...
Thanks anyway,
Doug
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:ePeJe3OhEHA.3272@.TK2MSFTNGP11.phx.gbl...
> AFAIK, the restore dialog doesn't care at all whether the backup files
archive bit is set or not.
> Actually, it doesn't even care whether the file in question *exists*. My
guess is that your problem
> is elsewhere. You might want to troubleshoot this by doing a backup,
verify that EM show this, set
> the archive bit and check EM again.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/|||Strange indeed. Can you point me to exactly what dialog you refer to (how to
you "click" to get
there) and I'll give it a spin. I've never encountered this, or even thought
about the archive bit
being relevant...
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Doug Crabtree" <not@.gonna.tell> wrote in message news:nOOdnVUDjKWVzr7cRVn-qA@.comcast.com...

> I have tried that. It dissapears from the selection dialog when the archi
ve
> bit is not set. When set, it appears again.
> Strange...
> Thanks anyway,
> Doug
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote i
n
> message news:ePeJe3OhEHA.3272@.TK2MSFTNGP11.phx.gbl...
> archive bit is set or not.
> guess is that your problem
> verify that EM show this, set
>|||In Enterprise Manager, Right click on Databases, and select All Tasks ->
Restore Database...
"Restore Database" Dialog Box
Restore as database: <<DBNAME>>
From Device selected
Restore backup set (Database - complete) selected
Click Select Devices button
"Choose Restore Devices" Dialog Box
Disk selected
Click Add button
"Choose Restore Destination" dialog box:
File Name (click the ...)
"Backup Device Location - <<SERVERNAME>>" Dialog box:
They don't show.
----
--
Interesting, though ... I copied one of the backups to another disk, turned
off the archive bit, and it showed there. Something about that drive?
Permissions? We have the Server running as an administrator's account.
Would that have anything to do with it?
Thanks,
Doug
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:OtgmcOShEHA.1156@.TK2MSFTNGP10.phx.gbl...
> Strange indeed. Can you point me to exactly what dialog you refer to (how
to you "click" to get
> there) and I'll give it a spin. I've never encountered this, or even
thought about the archive bit
> being relevant...
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/|||I tried your steps and I could not reproduce, the file did show, regardless
of what I set the "the file is
ready for ..." option in Explorer (I assume this is the ol' archive bit).
I did a Profiler trace and it seems like EM is executing xp_dirtree to get t
his list. This might give you
something to go on when searching KB, Google etc.
Also, opening a case with MS might be an option.
I doubt is has anything to do with permissions. But who know...
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Doug Crabtree" <not@.gonna.tell> wrote in message news:np-dnVZYZaxf9b7cRVn-ig@.comcast.com...

> In Enterprise Manager, Right click on Databases, and select All Tasks ->
> Restore Database...
> "Restore Database" Dialog Box
> Restore as database: <<DBNAME>>
> From Device selected
> Restore backup set (Database - complete) selected
> Click Select Devices button
> "Choose Restore Devices" Dialog Box
> Disk selected
> Click Add button
> "Choose Restore Destination" dialog box:
> File Name (click the ...)
> "Backup Device Location - <<SERVERNAME>>" Dialog box:
> They don't show.
> ----
--
> --
> Interesting, though ... I copied one of the backups to another disk, turne
d
> off the archive bit, and it showed there. Something about that drive?
> Permissions? We have the Server running as an administrator's account.
> Would that have anything to do with it?
> Thanks,
> Doug
>
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote i
n
> message news:OtgmcOShEHA.1156@.TK2MSFTNGP10.phx.gbl...
> to you "click" to get
> thought about the archive bit
>|||Interesting problem indeed -- can you use the "native" T-SQL RESTORE to
perform the database restore?
Steve
"Doug Crabtree" <not@.gonna.tell> wrote in message
news:np-dnVZYZaxf9b7cRVn-ig@.comcast.com...
> In Enterprise Manager, Right click on Databases, and select All Tasks ->
> Restore Database...
> "Restore Database" Dialog Box
> Restore as database: <<DBNAME>>
> From Device selected
> Restore backup set (Database - complete) selected
> Click Select Devices button
> "Choose Restore Devices" Dialog Box
> Disk selected
> Click Add button
> "Choose Restore Destination" dialog box:
> File Name (click the ...)
> "Backup Device Location - <<SERVERNAME>>" Dialog box:
> They don't show.
> ----
--
> --
> Interesting, though ... I copied one of the backups to another disk,
turned
> off the archive bit, and it showed there. Something about that drive?
> Permissions? We have the Server running as an administrator's account.
> Would that have anything to do with it?
> Thanks,
> Doug
>
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote
in
> message news:OtgmcOShEHA.1156@.TK2MSFTNGP10.phx.gbl...
(how[vbcol=seagreen]
> to you "click" to get
> thought about the archive bit
>|||I can acutally just type in the name of the file in the "Choose Restore
Destination" Dialog Box. It will restore it, they just don't show in the
dir tree.
Doug
"Steve Thompson" <stevethompson@.nomail.please> wrote in message
news:uxhb6pUhEHA.3664@.TK2MSFTNGP12.phx.gbl...
> Interesting problem indeed -- can you use the "native" T-SQL RESTORE to
> perform the database restore?
> Steve

2ND POST: Is there a way to insert a record using another as a tem

Hi
If you specify the column list then you insert values into those columns.
Missing columns will be set to NULL (if it is allowed) or a default value.
To update existing data use the UPDATE statement, you will only change the
values for columns specified in the SET clause. More information on the
INSERT and UPDATE statements can be found in Books Online.
Using stored procedure may help to remove any issues with different versions
as you will ship the correct procedure with the changes to the schema.
You can look at the INFORMATION_SCHEMA.columns view to find out what columns
a table has, although a different approach would be to only provide a
solution for the latest version and check they are on that version otherwise
force an upgrade.
John
"SA Development" wrote:

> Hi,
> I am currently inserting a record using:
> insert into TABLE(FIELD1,FIELD2) values ('%s',%d)
> But, the problem I have is that the table I am connecting to can either ha
ve
> 46 fields or 47 fields depending on its version. Is there a command that
> would allow me to use an existing record as a template and only specified
> the fields I want to change and then insert the new record?
> Something like:
> insert into TABLE(FIELD1) value ('%s') using template record where
> FIELD1='9999999' ?
> Thanks,
> SA Dev
>
>Thanks for the good ideas everyone, sorry my first post wasn't entirely
clear.
Lets say I have a table like this:
field1(key) field2 field3 field4 field5
9999 a b c d
What I was hoping to do is add a new record (field1=123 for example), but
use the 9999 as a template record so that its field values are inserted into
my new record EXCEPT for any that I override.
It sounds like the update command will let me update just the fields I want,
is there a way to tell SQL to copy record 9999 to record 123 and use all the
field values in record 9999 ?
Thanks,
Alan|||Hi David,

> INSERT INTO YourTable (col1, col2, col3, col4, col5)
> SELECT 123, col2, col3, col4, col5
> FROM YourTable
> WHERE col1 = 9999
Thank you -- that is exactly what I needed!
Thanks to everyone else who posted as well.
Have a great day,
Alan

Sunday, February 19, 2012

2005 Management Studio: Jobs Details (summary page)

I'm missing the info I got from EM on jobs, in the summary page, e.g. when a
job was last run, success/failure, scheduled, enabled, etc.
I don't see any way to add these columns on the summary page in Managment
Studio, am I missing something, or is this info not available there?
Thanks
Tom
TomT wrote:
> I'm missing the info I got from EM on jobs, in the summary page, e.g. when a
> job was last run, success/failure, scheduled, enabled, etc.
> I don't see any way to add these columns on the summary page in Managment
> Studio, am I missing something, or is this info not available there?
> Thanks
> Tom
Tom,
Go to Object Explorer - SQL Server Agent - Jobs. Here you can right
click on the job and get the job history, properties etc. Pretty much
the same as you're used to on EM but it looks a bit different.
HTH
Regards
Steen
|||Hi Tom,
In SQL Server 2005, we use Job Activity Monitor to see following items
Name - Name of the job.
Enabled - Whether the job is enabled (yes) or not enabled (no).
Status - Current status of the job.
Last Run Outcome - Job status when last run.
Last Run - Date and time job was last run.
Next Run - Date and time the job is next scheduled to run.
Category - The job category assigned to the job.
Runnable - Yes if the job can be run; No if the job cannot be run.
Scheduled - Yes if the job is assigned to a job schedule; No if the job has
no schedule.
For more detailed information, check BOL or MSDN topic
Job Activity Monitor
http://msdn2.microsoft.com/en-us/library/ms188272.aspx
How to: View Job Activity (SQL Server Management Studio)
http://msdn2.microsoft.com/en-us/library/ms187449.aspx
Monitoring Job Activity
http://msdn2.microsoft.com/en-us/library/ms188272.aspx
How to: Set Up the Job History Log (SQL Server Management Studio)
http://msdn2.microsoft.com/en-us/library/ms175072.aspx
Thank you for your patience and cooperation. If you have any questions or
concerns, don't hesitate to let me know. We are always here to be of
assistance!
Sincerely yours,
Michael Cheng
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ===
This posting is provided "AS IS" with no warranties, and confers no rights.